50. Pow(x, n) (中等) double myPow(double x, int n) { ; unsigned long long p; ) { p = -n; x = / x; } else { p = n; } while (p) { ) ans *= x; x *= x; p >>= ; } return ans; } 96. Unique Binary Search Trees(很快) class Solution { public: int numTrees(int n)…
题目一: 反转从位置 m 到 n 的链表.请使用一趟扫描完成反转. 说明:1 ≤ m ≤ n ≤ 链表长度. 示例: 输入: 1->2->3->4->5->NULL, m = 2, n = 4输出: 1->4->3->2->5->NULL 方法一: 1.和链表反转很相似,增加了难度,需要选择一定的区间: 2.找到区间进行反转,最后再将链表和之前的进行连接: 3.首先找到反转链表的前一位,for(int i=0;i<m-1;i++) pre=…
# Title Solution Acceptance Difficulty Frequency 1 Two Sum 44.5% Easy 2 Add Two Numbers 31.7% Medium 3 Longest Substring Without Repeating Characters 28.8% Medium 4 Median of Two Sorted Arrays 27.2% Hard 5…