- 博客(8)
- 资源 (3)
- 收藏
- 关注
原创 LeetCode35. Search Insert Position轻松解决
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the array.
2016-02-21 21:14:12 662
原创 LeetCode31. Next Permutation最清晰的解法
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it must rearrange it as the lowest possible
2016-02-20 19:50:31 627
原创 LeetCode96. Unique Binary Search Trees简单,简洁
Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a total of 5 unique BST's. 1 3 3 2 1 \
2016-02-18 22:44:10 387
原创 LeetCode319. Bulb Switcher优化到只有一行代码
There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you toggle every third bulb (turning on if it's off or turning off
2016-02-17 22:46:30 723
原创 LeetCode326. Power of Three一行代码解决
Given an integer, write a function to determine if it is a power of three.Follow up:Could you do it without using any loop / recursion?Credits:Special thanks to @dietpepsi for adding this
2016-02-16 21:32:43 1529
原创 LeetCode328. Odd Even Linked List
Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.You should try to do it in
2016-02-16 20:47:34 508
原创 LeetCode29. Divide Two Integers一个好答案
Divide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT.class Solution {public: int divide(int dividend, int divisor) { if(divisor =
2016-02-03 22:16:13 408
原创 LeetCode24. Swap Nodes in Pairs简单到一次性通过
Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should use only constant space. Y
2016-02-02 21:01:22 2296 3
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人