Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1 1 /** 2 * Definition for a binary tre...
分类:
其他好文 时间:
2015-07-20 10:35:00
阅读次数:
93
Given two sorted integer arraysnums1andnums2, mergenums2intonums1as one sorted array.Note:You may assume thatnums1has enough space (size that is great...
分类:
其他好文 时间:
2015-07-20 10:33:13
阅读次数:
108
Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is1 -> 2 -> 3 -> ...
分类:
其他好文 时间:
2015-07-20 10:32:13
阅读次数:
142
Given an integern, generate a square matrix filled with elements from 1 ton2in spiral order.For example,Givenn=3,You should return the following matri...
分类:
其他好文 时间:
2015-07-20 10:30:20
阅读次数:
108
Write a function that takes an unsigned integer and returns the number of ’1' bits it hasFor example, the 32-bit integer ’11' has binary representatio...
分类:
其他好文 时间:
2015-07-20 10:29:37
阅读次数:
104
Given an array of sizen, find the majority element. The majority element is the element that appears more than? n/2 ?times.You may assume that the arr...
分类:
其他好文 时间:
2015-07-20 10:29:23
阅读次数:
100
Given an array withnobjects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, wh...
分类:
其他好文 时间:
2015-07-20 10:27:23
阅读次数:
109
Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the arr...
分类:
其他好文 时间:
2015-07-20 10:27:15
阅读次数:
121
Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical an...
分类:
其他好文 时间:
2015-07-19 21:37:22
阅读次数:
139
Implementatoito convert a string to an integer.Hint:Carefully consider all possible input cases. If you want a challenge, please do not see below and ...
分类:
其他好文 时间:
2015-07-19 21:27:59
阅读次数:
134