leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

commit a2e4ad2e487451ad788aff860d7764833c6e9a19
parent 76a3e2f7cac294e52c95cc6bb8e604834716b7e9
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date:   Mon,  6 Feb 2023 15:30:10 +0100

Daily Problem

Diffstat:
AProblems/1470.cpp | 11+++++++++++
MREADME.md | 1+
2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/Problems/1470.cpp b/Problems/1470.cpp @@ -0,0 +1,11 @@ +class Solution { +public: + vector<int> shuffle(vector<int>& nums, int n) { + vector<int> res(n*2); + for(int i=0; i<n; i++) { + res[2*i] = nums[i]; + res[2*i+1] = nums[n+i]; + } + return res; + } +}; diff --git a/README.md b/README.md @@ -335,6 +335,7 @@ for solving problems. | 1443 | Medium | [Minimum Time to Collect All Apples in a Tree](Problems/1443.cpp) | | 1462 | Medium | [Course Schedule IV](Problems/1462.cpp) | | 1466 | Medium | [Reorder Routes to Make All Paths Lead to the City Zero](Problems/1466.cpp) | +| 1470 | Easy | [Shuffle the Array](Problems/1470.cpp) | | 1472 | Medium | [Design Browser History ](Problems/1472.cpp) | | 1480 | Easy | [Running Sum of 1d Array](Problems/1480.cpp) | | 1489 | Hard | [Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree](Problems/1489.cpp) |