| 2239 |
|
|
|
|
| https://leetcode.com/problems/find-closest-number-to-zero/description/ |
Find Closest Number to Zero |
Take the absolute value and compare the minimum. |
https://www.youtube.com/watch?v=dLlKA5DQKYs&list=PLKYEe2WisBTFEr6laH5bR2J19j7sl5O8R&index=4 |
‣ |
| 13 |
|
|
|
|
| https://leetcode.com/problems/roman-to-integer/description/ |
Roman to Integer |
C<M: |
|
|
| CM->C<M: sum+= M-C: jump loop by 2 |
|
|
|
|
| MC-> M>C : sum + = M: jump loop by 1 |
|
|
|
|
| https://www.youtube.com/watch?v=JlVOzbOJiv0&list=PLKYEe2WisBTFEr6laH5bR2J19j7sl5O8R&index=5 |
‣ |
|
|
|
| 392 |
|
|
|
|
| https://leetcode.com/problems/is-subsequence/description/ |
Is Subsequence |
Using 2 pointer one for 1st string and other for 2nd string; compare i and j if matches inc both else inc only j. If traversed 1st string and at end return ans |
https://www.youtube.com/watch?v=M_OB20n4hfo&list=PLKYEe2WisBTFEr6laH5bR2J19j7sl5O8R&index=7 |
‣ |
| 2 |
|
|
|
|
| https://leetcode.com/problems/add-two-numbers/description/ |
Add two Number |
Traverse through both linked list and maintain a carry to be added |
|
|
| Edge case for remaining element; loop and add to the linked list |
https://www.youtube.com/watch?v=di_jUp3tWUI |
‣ |
|
|
| 121 |
|
|
|
|
| https://leetcode.com/problems/best-time-to-buy-and-sell-stock/description/ |
Best Time to Buy and Sell Stock |
Maintain a local minima and return max profit comparing |
https://www.youtube.com/watch?v=kJZrMGpyWpk&list=PLKYEe2WisBTFEr6laH5bR2J19j7sl5O8R&index=7 |
‣ |
| 28 |
|
|
|
|
| https://leetcode.com/problems/find-the-index-of-the-first-occurrence-in-a-string/description/ |
Find the Index of the First Occurrence in a String |
3 index; |
|
|
| i, k : 1st string |
|
|
|
|
| j : 2nd string |
|
|
|
|