Remove all elements from a linked list of integers that have value val. Example*****Given:* 1 –> 2 …
分类:LeetCode
2012.9.15 Leetcode 258. Add Digits
Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For examp…
369. Plus One Linked List
369- Plus One Linked List **Question Editorial Solution My Submissions Total Accepted: 1189 Total Submissions:…
[LeetCode] Divide Two Integers 两数相除
Divide two integers without using multiplication, division and mod operator. If it is overflow, return …
[LeetCode] Search in a Binary Search Tree 二叉搜索树中搜索
Given the root node of a binary search tree (BST) and a value. You need to find the node in the BST tha…
LeetCode | Unique Binary Search Trees
题目: Given n, how many structurally unique BST’s (binary search trees) that store values 1…
【leetcode】66. Plus One 用单个数字列表表示的数进行加一返回同样的数字列表形式
1. 题目 Given a non-negative number represented as an array of digits, plus one to the number. The digits are st…
Leetcode295. Find Median from Data Stream
Straight-forward solution. O(n) space, O(1)(get) + O(nlogn)(sort the array before getting median) time solutio…
Java中的获取长度
Java语言也许是在设计之初有一点点没有完全计划好,导致各种不同的数据类型在获取长度的时候方法完全不同。相较于Python,几乎所有有长度的变量都可以用len()来获取长度。 String类 String test_st…
LeetCode[17] - Peeking Iterator
再一次理解错题意. peek() 就是头顶,但是不一定是最大值啊。总是把PEEK想成了最大值,然后用2 STACK做了最大值的cache,练的一手好双stack,可惜错了。 回到原题,其实不难。找一个cache来存nex…
[LeetCode By Go 85]118. Pascal's Triangle
题目 Given numRows, generate the first numRows of Pascal’s triangle. For example, given numRows = 5, Retur…
[LeetCode By Go 65]594. Longest Harmonious Subsequence
题目 We define a harmonious array is an array where the difference between its maximum value and its minimum val…