OnlineJuge
搬砖小chen
相信坚持的力量
展开
-
[LeetCode] 292. Nim Game
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 to 3 stones. The one who removes the last stone will be the原创 2016-08-22 19:12:30 · 153 阅读 · 0 评论 -
[C++] LeetCode 70. Climbing Stairs
题目描述:You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?Note: Given n will be a p...原创 2019-01-30 15:20:45 · 148 阅读 · 0 评论 -
[LeetCode] 3. Longest Substring Without Repeating Characters (C++)
题目描述Given a string, find the length of the longest substring without repeating characters.Example 1:Input: "abcabcbb"Output: 3 Explanation: The answer is "abc", with the length of 3. Examp...原创 2019-01-24 14:03:03 · 175 阅读 · 0 评论 -
[LeetCode] 2. Add Two Numbers (C++)
题目描述:You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and r...原创 2019-01-18 15:29:02 · 271 阅读 · 0 评论 -
[LeetCode] 693. Binary Number with Alternating Bits (C++)
Given a positive integer, check whether it has alternating bits: namely, if two adjacent bits will always have different values.Example 1:Input: 5Output: TrueExplanation:The binary representat...原创 2019-01-18 15:29:30 · 108 阅读 · 0 评论 -
[LeetCode] 821. Shortest Distance to a Character (C++)
Given a string S and a character C, return an array of integers representing the shortest distance from the character C in the string.Example 1:Input: S = "loveleetcode", C = 'e'Output: [3, 2, 1...原创 2019-01-18 15:29:17 · 122 阅读 · 0 评论 -
[LeetCode] 806. Number of Lines To Write String (C++)
We are to write the letters of a given string S, from left to right into lines. Each line has maximum width 100 units, and if writing a letter would cause the width of the line to exceed 100 units, it...原创 2019-01-18 15:29:40 · 131 阅读 · 0 评论 -
[LeetCode] 867. Transpose Matrix (C++)
Given a matrix A, return the transpose of A.The transpose of a matrix is the matrix flipped over it's main diagonal, switching the row and column indices of the matrix. Example 1:Input: [[1,2...原创 2018-11-01 15:55:45 · 241 阅读 · 0 评论 -
[LeetCode] 559. Maximum Depth of N-ary Tree(C++)
Given a n-ary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.For example, given a 3-ary tree: ...原创 2018-10-31 15:29:27 · 248 阅读 · 0 评论 -
[LeetCode] 922. Sort Array By Parity II(C++)
Given an array A of non-negative integers, half of the integers in A are odd, and half of the integers are even.Sort the array so that whenever A[i] is odd, i is odd; and whenever A[i] is even, i is...原创 2018-10-31 14:25:28 · 139 阅读 · 0 评论 -
[LeetCode] 905. Sort Array By Parity(C++)
Given an array A of non-negative integers, return an array consisting of all the even elements of A, followed by all the odd elements of A.You may return any answer array that satisfies this conditi...原创 2018-10-31 14:25:38 · 125 阅读 · 0 评论 -
[LeetCode] 709. To Lower Case(C++)
Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase. Example 1:Input: "Hello"Output: "hello"Example 2:Input: "here"Output: "here"...原创 2018-10-31 14:25:19 · 633 阅读 · 0 评论 -
[LeetCode] 654. Maximun Binary Tree(C++)
Given an integer array with no duplicates. A maximum tree building on this array is defined as follow:The root is the maximum number in the array. The left subtree is the maximum tree constructed f...原创 2018-10-23 17:42:04 · 161 阅读 · 0 评论 -
LeetCode 921
Given a string S of '(' and ')' parentheses, we add the minimum number of parentheses ( '(' or ')', and in any positions ) so that the resulting parentheses string is valid.Formally, a parentheses s...原创 2018-10-22 20:52:30 · 175 阅读 · 0 评论 -
[LeetCode] 807. Max increase to keep city skyline(C++)
In a 2 dimensional array grid, each value grid[i][j] represents the height of a building located there. We are allowed to increase the height of any number of buildings, by any amount (the amounts can...原创 2018-10-22 17:07:37 · 134 阅读 · 0 评论 -
[C++] LeetCode 9. Palindrome Number
题目描述Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.Example 1:Input: 121Output: trueExample 2:Input: -121Output: fals...原创 2019-01-30 16:00:11 · 169 阅读 · 0 评论