A simple C++ solution to Leetcode 387. First Unique Character in a String.
How to convert a 2D grid to a 1D vector to make the shifting operations simpler. The modulo operator helps loop back to the start of the vector after k shifts.
Two C++ approaches for solving Leetcode 739. Daily Temperatures. The first one uses nested loops with O(N^2) runtime. The second one reduces the runtime to O(N) by using only one loop.
Two approaches for solving Leetcode 922. Sort Array By Parity II. One uses Buble sort, which takes O(N^2) runtime. The other uses the Two-pointer technique to reduce runtime to O(N).
A simple solution to LeetCode Challenge 48. Rotate Image. The math behind is rotating a matrix by 90 degrees can be done by following 2 steps: transpose the matrix, then mirror the matrix vertically.
Two approaches for solving Leetcode Challenge 80. Remove Duplicates from Sorted Array II. The key is to either erase duplicates beyond two occurrences while preserving order or reassign valid elements (up to two of each) to the first k indexes of nums.