- 博客(13)
- 收藏
- 关注
原创 260. Single Number III
Description: Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once.For example:Give
2016-11-18 17:19:00 114
原创 414. Third Maximum Number
Description: Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexity must be in O(n).Example 1:Input: [
2016-11-18 16:59:56 174
原创 24. Swap Nodes in Pairs
Description: 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 spac
2016-11-18 14:51:09 130
原创 190. Reverse Bits
Description: Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 0
2016-11-16 16:25:52 129
原创 263. Ugly Number
Description: Write a program to check whether a given number is an ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8 are ugly while 14 is not ugl
2016-11-16 15:51:44 116
原创 21. Merge Two Sorted Lists
Description: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.解题思路这道题的思路不难,首先根据l1和l2的值确定head的位置,然后循环比较大小,修改ne
2016-11-16 15:36:42 149
原创 441. Arranging Coins
Description: You have a total of n coins that you want to form in a staircase shape, where every k-th row must have exactly k coins.Given n, find the total number of full staircase rows that can be for
2016-11-09 16:55:21 301
原创 447. Number of Boomerangs
Description: Given n points in the plane that are all pairwise distinct, a “boomerang” is a tuple of points (i, j, k) such that the distance between i and j equals the distance between i and k (the ord
2016-11-09 16:16:14 137
原创 121. Best Time to Buy and Sell Stock
Description: Say you have an array for which the i-th element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of th
2016-11-09 15:47:12 146
原创 409. Longest Palindrome
Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters.This is case sensitive, for example “Aa” is not consider
2016-11-09 10:35:22 139
原创 405. Convert a Number to Hexadecimal
Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complement method is used.Note:All letters in hexadecimal (a-f) must be in lowercase.The hexade
2016-11-02 21:40:59 139
原创 100. Same Tree
Description: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 and the nodes have the same valu
2016-11-02 20:35:56 137
原创 226. Invert Binary Tree
Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1解题思路:利用递归方式解决,左孩子为右递归,右孩子为左递归。Java-Solution:{CSDN:CODE:1962
2016-11-02 16:29:18 118
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人