摘要:
1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(int x) : val(x), ne... 阅读全文
摘要:
Same thing need to as :Whether m > n, m > list size, or n > list size 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * in... 阅读全文
摘要:
Remember to check overflows. 1 class Solution { 2 public: 3 int reverse(int x) { 4 int sign = x 0) { 7 if (result > (INT_MAX ... 阅读全文
摘要:
Two method of making that:1. As we know this is 32 bit integer. We just get the bit and shift to 31 - i. 1 class Solution { 2 public: 3 uint32_t r... 阅读全文
摘要:
1 class Solution { 2 public: 3 bool isIp(string s) { 4 int len = s.size(), ip = 0; 5 if (len == 0 || len > 4 || len > 1 && s[0] =... 阅读全文
摘要:
1. Find mid point and break it into two lists2. reverse the second list (mid to end)3. reinsert into first one. 1 /** 2 * Definition for singly-linke... 阅读全文
摘要:
If interview did not mention n's situation, please ask.It will affect the code. EX: n = 10, List : 1 2 3. 1 /** 2 * Definition for singly-linked list... 阅读全文