随笔分类 -  LeetCode

342. Power of Four
摘要:1. 问题描述 Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example:Given num = 16, return true. Given num = 5, r 阅读全文

posted @ 2016-07-17 22:09 whl-hl 阅读(277) 评论(0) 推荐(0)

326. Power of Three
摘要:1. 问题描述 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?Tags: M 阅读全文

posted @ 2016-07-14 22:26 whl-hl 阅读(176) 评论(0) 推荐(0)

231. Power of Two
摘要:1. 问题描述 Given an integer, write a function to determine if it is a power of two.Tags: Math Bit ManipulationSimilar Problems: (E) Number of 1 Bits (E) 阅读全文

posted @ 2016-07-12 23:05 whl-hl 阅读(168) 评论(0) 推荐(0)

191. Number of 1 Bits
摘要:1. 问题描述 Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight). For example, the 阅读全文

posted @ 2016-07-03 22:36 whl-hl 阅读(124) 评论(0) 推荐(0)

283. Move Zeroes
摘要:1. 问题描述 Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. For exam 阅读全文

posted @ 2016-06-29 22:04 whl-hl 阅读(157) 评论(0) 推荐(0)

237. Delete Node in a Linked List
摘要:1. 问题描述 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 is 1 -> 阅读全文

posted @ 2016-06-27 22:45 whl-hl 阅读(125) 评论(0) 推荐(0)

100. Same Tree
摘要:1. 问题描述 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 ide 阅读全文

posted @ 2016-06-26 22:13 whl-hl 阅读(157) 评论(0) 推荐(0)

226. Invert Binary Tree
摘要:1. 问题描述 Invert a binary tree. to Tag: Tree /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right 阅读全文

posted @ 2016-06-23 21:30 whl-hl 阅读(158) 评论(0) 推荐(0)

169. Majority Element
摘要:1. 问题描述 Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume t 阅读全文

posted @ 2016-06-23 21:29 whl-hl 阅读(140) 评论(0) 推荐(0)

349. Intersection of Two Arrays
摘要:1. 问题描述 Given two arrays, write a function to compute their intersection. Example: Note: Each element in the result must be unique.The result can be i 阅读全文

posted @ 2016-06-18 19:27 whl-hl 阅读(166) 评论(0) 推荐(0)

104. Maximum Depth of Binary Tree
摘要:1. 问题描述 Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the far 阅读全文

posted @ 2016-06-18 19:06 whl-hl 阅读(128) 评论(0) 推荐(0)

258. Add Digits
摘要:1. 问题描述 Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example: Given num = 38, the process i 阅读全文

posted @ 2016-06-18 18:49 whl-hl 阅读(118) 评论(0) 推荐(0)

292. Nim Game
摘要:1. 问题描述 You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 t 阅读全文

posted @ 2016-06-18 17:53 whl-hl 阅读(128) 评论(0) 推荐(0)

21. Merge Two Sorted Lists
摘要:1. 问题描述 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.T 阅读全文

posted @ 2016-06-17 21:44 whl-hl 阅读(133) 评论(0) 推荐(0)

43. Multiply Strings
摘要:1. 问题描述 Given two numbers represented as strings, return multiplication of the numbers as a string.Note:The numbers can be arbitrarily large and are n 阅读全文

posted @ 2016-06-16 22:35 whl-hl 阅读(97) 评论(0) 推荐(0)

66. Plus One
摘要:1. 问题描述 Given a non-negative number represented as an array of digits, plus one to the number. The digits are stored such that the most significant di 阅读全文

posted @ 2016-06-15 22:22 whl-hl 阅读(208) 评论(0) 推荐(0)

67. Add Binary
摘要:1. 问题描述 Given two binary strings, return their sum (also a binary string). Tags: Math String 2. 解答思路 3. 代码 4. 反思 阅读全文

posted @ 2016-06-14 21:56 whl-hl 阅读(131) 评论(0) 推荐(0)

2. Add Two Numbers
摘要:1. 问题描述 You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a 阅读全文

posted @ 2016-06-13 22:04 whl-hl 阅读(143) 评论(0) 推荐(0)

8. String to Integer (atoi)
摘要:1. 问题描述 Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not se 阅读全文

posted @ 2016-06-13 20:18 whl-hl 阅读(142) 评论(0) 推荐(0)

18. 4Sum
摘要:1. 问题描述 Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the ar 阅读全文

posted @ 2016-06-12 21:35 whl-hl 阅读(129) 评论(0) 推荐(0)

导航