Middle of the Linked List problem results Middle of the Linked List First Blood Saving each node in a vector, calculate the middle index, and get the node in the vector. { ListNode* middleN...
Leetcode 142 Linked List Cycle II
Linked List Cycle II problem results Linked List Cycle II First Blood Saving the visited node in an unordered_set, stop when meeting the same node. { ListNode *detectCycle(ListNode *hea...
Leetcode 0206 Reverse Linked List
Reverse Linked List problem results Reverse Linked List First Blood Iterative Method. { ListNode* reverseList(ListNode* head) { if(head == nullptr || head->next == nullptr) ...
Leetcode 0021 Merge Two Sorted Lists
Merge Two Sorted Lists problem results Merge Two Sorted Lists I should try a recursive method later. First Blood Iterative method. { ListNode* mergeTwoLists(ListNode* list1, ListNode* list...
Leetcode 0392 Is Subsequence
Is Subsequence problem results Is Subsequence First Blood Easiest method. Two-pointer. Traversing each string, update the index of “s” when finding the same character in t, else only update the...
Leetcode 0205 Isomorphic Strings
Isomorphic String problem results Isomorphic String I can find an excuse this time for my multiple failures. I had a fever that time after getting the booster of Covid19. My mind is not clear. ...
Leetcode 1480 Running Sum of 1d Array
Running Sum of 1d Array problem results Running Sum of 1d Array First Blood My first solution is so straightforward, that I created a new vector to save the running sum { vector<int> ...
Leetcode 0724 Find Pivot Index
Find Pivot Index problem results Find Pivot Index The pivot index is the index where the sum of all the numbers strictly to the left of the index is equal to the sum of all the numbers strictly...
Leetcode List
No Link 0001 Two Sum 0002 Add Two Numbers 0003 Longest Substring without Repeating Characters ...
Leetcode 0033 Search in Rotated Sorted Array
Search in Rotated Sorted Array problem results Search in Rotated Sorted Array First Blood I got a wrong answer because I forget to check if the pivot number is equal to the target. Double Kil...