自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(53)
  • 收藏
  • 关注

原创 LeetCode 287. Find the Duplicate Number 题解(C++)

Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate number, find the dup

2016-11-10 15:16:02 448

原创 LeetCode 452. Minimum Number of Arrows to Burst Balloons 题解(C++)

here are a number of spherical balloons spread in two-dimensional space. For each balloon, provided input is the start and end coordinates of the horizontal diameter. Since it's horizontal, y-coordinates donoor

2016-11-09 18:21:55 754

原创 LeetCode 453. Minimum Moves to Equal Array Elements 题解(C++)

Given a non-empty integer array of size n, find the minimum number of moves required to make all array elements equal, where a move is incrementing n - 1 elements by 1.n

2016-11-09 09:57:06 685

原创 LeetCode 436. Find Right Interval 题解(C++)

Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.

2016-11-07 19:54:10 392

原创 LeetCode 436. Find Right Interval 题解(C++)

Given a set of intervals, for each of the interval i, check if there exists an interval j whose start point is bigger than or equal to the end point of the interval i, which can be called that j is on the "righ

2016-11-02 16:25:59 836

原创 LeetCode 318. Maximum Product of Word Lengths 题解(C++)

Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. You may assume that each word will contain only lower case letters.

2016-11-02 14:03:10 485

原创 LeetCode 319. Bulb Switcher 题解(C++)

There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you toggle every third bulb

2016-11-01 21:34:35 406

原创 LeetCode 52. N-Queens II 题解(C++)

Follow up for N-Queens problem. Now, instead outputting board configurations, return the total number of distinct solutions.

2016-10-27 22:22:23 361

原创 LeetCode 12. Integer to Roman 题解(C++)

Given an integer, convert it to a roman numeral.

2016-10-27 14:04:35 298

原创 LeetCode 144. Binary Tree Preorder Traversal 题解(C++)

Given a binary tree, return the preorder traversal of its nodes' values.

2016-10-25 19:55:21 440

原创 LeetCode 378. Kth Smallest Element in a Sorted Matrix 题解(C++)

Given a n x n matrix where each of the rows and columns are sorted in ascending order, find the kth smallest element in the matrix.

2016-10-24 22:08:43 447

原创 LeetCode 206. Reverse Linked List 题解(C++)

Reverse a singly linked list.

2016-10-23 16:18:19 1629

原创 LeetCode 13. Roman to Integer 题解(C++)

Given a roman numeral, convert it to an integer.

2016-10-23 11:00:30 744

原创 LeetCode 94. Binary Tree Inorder Traversal 题解(C++)

Given a binary tree, return the inorder traversal of its nodes' values.

2016-10-22 15:13:42 430

原创 LeetCode 401. Binary Watch 题解(C++)

LeetCode 401. Binary Watch 题解(C++)题目描述A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59).Each LED represents a zero or on

2016-10-21 14:48:03 1300

原创 LeetCode 268. Missing Number 题解(C++)

Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array.

2016-10-20 12:13:54 567

原创 LeetCode 350. Intersection of Two Arrays II 题解(C++)

Given two arrays, write a function to compute their intersection.

2016-10-20 10:23:00 429

原创 LeetCode 217. Contains Duplicate 题解(C++)

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 array, and it should return false if every element is distinct.

2016-10-20 09:50:33 395

原创 LeetCode 392. Is Subsequence 题解(C++)

Given a string s and a string t, check if s is subsequence of t. - You may assume that there is only lower case English letters in both s and t. t is potentially a very long (length ~= 500,000) string, and s

2016-10-19 16:06:09 416

原创 LeetCode 169. Majority Element 题解(C++)

Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.

2016-10-19 14:41:46 659

原创 LeetCode 242. Valid Anagram 题解(C++)

Given two strings s and t, write a function to determine if t is an anagram of s.

2016-10-19 13:43:33 1430

原创 LeetCode 387. First Unique Character in a String 题解(C++)

Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1.

2016-10-18 19:40:23 324

原创 LeetCode 419. Battleships in a Board 题解(C++)

Given an 2D board, count how many different battleships are in it. The battleships are represented with 'X's, empty slots are represented with '.'s. You may assume the following rules:

2016-10-18 11:14:57 813

原创 LeetCode 343. Integer Break 题解(C++)

Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum product you can get.

2016-10-17 20:30:55 349

原创 LeetCode 413. Arithmetic Slices 题解(C++)

A sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same.

2016-10-15 21:26:22 896

原创 LeetCode 412. Fizz Buzz 题解(C++)

Write a program that outputs the string representation of numbers from 1 to n.

2016-10-15 16:32:40 302

原创 LeetCode 357. Count Numbers with Unique Digits 题解(C++)

Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10^n.

2016-10-14 16:12:44 295

原创 LeetCode 171. Excel Sheet Column Number 题解(C++)

Given a column title as appear in an Excel sheet, return its corresponding column number.

2016-10-13 17:59:09 372

原创 LeetCode 122. Best Time to Buy and Sell Stock II 题解(C++)

Say you have an array for which the ith element is the price of a given stock on day i.

2016-10-13 15:58:55 402

原创 LeetCode 347. Top K Frequent Elements 题解(C++)

Given a non-empty array of integers, return the k most frequent elements.

2016-10-12 16:25:24 730

原创 LeetCode 100. Same Tree 题解(C++)

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 value.

2016-10-12 11:35:33 308

原创 LeetCode 384. Shuffle an Array 题解(C++)

Shuffle a set of numbers without duplicates.

2016-10-12 10:29:23 347

原创 LeetCode 349. Intersection of Two Arrays 题解(C++)

Given two arrays, write a function to compute their intersection.

2016-10-11 15:44:20 537

原创 LeetCode 237. Delete Node in a Linked List 题解(C++)

Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.

2016-10-11 13:17:41 303

原创 LeetCode 383. Ransom Note 题解(C++)

Given
 an 
arbitrary
 ransom
 note
 string 
and 
another 
string 
containing 
letters from
 all 
the 
magazines,
 write 
a 
function 
that 
will 
return 
true 
if 
the 
ransom 
 note 
can 
be 
constructed 
from

2016-10-11 12:18:40 1017

原创 LeetCode 415. Add Strings 题解(C++)

Given two non-negative numbers num1 and num2 represented as string, return the sum of num1 and num2.

2016-10-11 10:27:24 1670

原创 LeetCode 382. Linked List Random Node 题解(C++)

Given a singly linked list, return a random node's value from the linked list. Each node must have the same probability of being chosen.

2016-10-10 20:24:09 433

原创 LeetCode 238. Product of Array Except Self 题解(C++)

LeetCode 238. Product of Array Except Self 题解(C++)题目描述Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums exc

2016-10-09 19:19:46 478

原创 LeetCode 404. Sum of Left Leaves 题解(C++)

LeetCode 404. Sum of Left Leaves 题解(C++)题目描述Find the sum of all left leaves in a given binary tree.示例There are two left leaves in the binary tree, with values 9 and 15 respectively. Return 24.思路解法1使

2016-10-08 21:06:32 361

原创 LeetCode 283. Move Zeroes 题解(C++)

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.

2016-10-08 17:00:30 307

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除