162 Find Peak Element
A peak element is an element that is greater than its neighbors.
Given an input array where num[i] ≠ num[i+1]
, find a peak element and return its index.
A peak element is an element that is greater than its neighbors.
Given an input array where num[i] ≠ num[i+1]
, find a peak element and return its index.
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.
(i.e., 0 1 2 4 5 6 7
might become 4 5 6 7 0 1 2
).
Given an array of integers, every element appears three times except for one, which appears exactly once. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
Given a binary tree containing digits from 0-9
only, each root-to-leaf path could represent a number.
An example is the root-to-leaf path 1->2->3
which represents the number 123
.
Given a binary tree
|
|
Given a binary tree, flatten it to a linked list in-place.
For example,
Given
|
|
之前一直懒得给自己的博客搭建“多说”评论系统。但没想到的是,多说居然要在今年6月底停止服务了,着实令人诧异。偶然在知乎上看到一个基于github issue搭建的评论系统,名叫gitment。这位作者也是相当有想法,佩服佩服。技术类博客的受众终究还是广大同性交友网站代码分享网站的注册用户,利用gitment作为本网站的评论系统再好不过了。下面就简单介绍一下如何将Gitmemt嵌入到基于hexo的博客主题当中。
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.
Given a collection of integers that might contain duplicates, nums, return all possible subsets.
Note: The solution set must not contain duplicate subsets.
The gray code is a binary numeral system where two successive values differ in only one bit.
Given a non-negative integer n representing the total number of bits in the code, print the sequence of gray code. A gray code sequence must begin with 0.