Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/yuvrajchandra/leetcode

This repository contains solution of Leetcode problems (in C++) and key points/takeaways/techniques involved in solving that problem.
https://github.com/yuvrajchandra/leetcode

Last synced: 2 days ago
JSON representation

This repository contains solution of Leetcode problems (in C++) and key points/takeaways/techniques involved in solving that problem.

Awesome Lists containing this project

README

        

# Leetcode
This repository contains solution of Leetcode problems (in C++) and key points/takeaways/techniques involved in solving that problem.

---

[1480. Running Sum of 1d Array](https://leetcode.com/problems/running-sum-of-1d-array/)
+ .size() is used to find size of vector.
For eg- int size = myVect.size();

---

[1431. Kids With the Greatest Number of Candies](https://leetcode.com/problems/kids-with-the-greatest-number-of-candies/)
+ To find max element of vector, following syntax is used.
For eg- int max = *max_element(candies.begin(),candies.end());

---

[1470. Shuffle the Array](https://leetcode.com/problems/shuffle-the-array/)
+ To intialize multiple variables in for loop following syntax is used:
for(int i=0;j=0;k=0; i());
```
+ To copy a vector to another-
```
vector newVec = oldVec;
```

---

[1630. Arithmetic Subarrays](https://leetcode.com/problems/arithmetic-subarrays/)
+ vec.end() points to the index equal to the size of the array.
+ To create a vector from sub-array of other array following syntax is used:
```
vector newVect(nums.begin()+1, nums.begin()+4+1);
// To copy elements of nums indexed between 1 to 4
```
Note : +1 is used with 2nd parameter due to given 1st point.

---