Lesson 10 of 24

vector: ಬೆಳೆಯುವ Array

9 min 30 XP

STL (Standard Template Library) C++ ನ superpower. vector ಬೆಳೆಯುವ array: push_back ಸೇರಿಸುತ್ತದೆ, size() ಎಣಿಸುತ್ತದೆ, v[i] ಅಥವಾ v.at(i) ಓದುತ್ತದೆ. Competitive programmers ಎಲ್ಲೆಡೆ vectors ಬಳಸುತ್ತಾರೆ.

Example: edit me and press Run

Output Loading C++ (first time takes a few seconds)
Press Run to see the result here.

v.at(i) ಮಿತಿ ಪರಿಶೀಲಿಸಿ exception ಕೊಡುತ್ತದೆ; v[i] ಪರಿಶೀಲಿಸುವುದಿಲ್ಲ ಆದರೆ ವೇಗ.

Challenge

+30 XP

n ಮತ್ತು n ಸಂಖ್ಯೆಗಳನ್ನು ಓದಿ ಅವುಗಳ prefix sums print ಮಾಡಿ (ಪ್ರತಿ ಸ್ಥಾನದಲ್ಲಿ ಅಲ್ಲಿಯವರೆಗಿನ ಮೊತ್ತ). Input: 5 1 2 3 4 5 Output: 1 3 6 10 15

Output Loading C++ (first time takes a few seconds)
Press Run to see the result here.