![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode
栾城
努力写一个引擎
展开
-
LeetCode4
LeetCode: Reverse Words in a String III题目Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.#例子Example 1原创 2017-11-07 18:19:06 · 161 阅读 · 0 评论 -
485. Max Consecutive Ones
485. Max Consecutive OnesGiven a binary array, find the maximum number of consecutive 1s in this array.Example 1:Input: [1,1,0,1,1,1]Output: 3Explanation: The first two digits or the last three digits原创 2017-11-23 15:41:13 · 187 阅读 · 0 评论 -
693. Binary Number with Alternating Bits
693. Binary Number with Alternating BitsGiven a positive integer, check whether it has alternating bits: namely, if two adjacent bits will always have different values.Example 1: Input: 5 Output: Tru原创 2017-11-23 15:14:20 · 145 阅读 · 0 评论 -
283MoveZeroes
283. Move ZeroesGiven 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 example, given nums = [0, 1, 0, 3, 12], after ca原创 2017-12-02 15:22:42 · 151 阅读 · 0 评论 -
136. Single Number
136. Single Number题目Given an array of integers, every element appears twice except for one. Find that single one.Note: Your algorithm should have a linear runtime complexity. Could you implement it wi原创 2017-11-22 21:05:23 · 133 阅读 · 0 评论 -
637Submission Details
637Submission Details思路代码vector<double> push(list <TreeNode> &open, vector<double> &averages) { if (!open.size()) return averages; double sum = 0; int amout = 0;原创 2017-11-22 20:02:22 · 244 阅读 · 0 评论 -
448FindAllNumbersDisappearedInAnArray
448. Find All Numbers Disappeared in an ArrayGiven an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.Find all the elements of [1, n] inclusi原创 2017-12-01 18:48:13 · 144 阅读 · 0 评论 -
RangeAdditionII、ConstructtheRectangle、ExcelSheetColumnNumber
RangeAdditionII、ConstructtheRectangle、ExcelSheetColumnNumberExcelSheetColumnNumberRelated to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding原创 2017-12-10 14:46:28 · 225 阅读 · 0 评论 -
496.Next Greater Element I
Next Greater Element IYou are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1’s elements in the correspondi原创 2017-11-21 19:16:47 · 184 阅读 · 0 评论 -
520DetectCapital
Given a word, you need to judge whether the usage of capitals in it is right or not.We define the usage of capitals in a word to be right when one of the following cases holds:All letters in this word原创 2017-11-29 14:54:22 · 170 阅读 · 0 评论 -
Reshape the Matrix
#代码想法一:在二维数组中,他的地址是有序、处于同一个内存空间的,{{1,2},{3,4}},在地址中表示相当与{1,2,3,4}。原想以这种方式来解决vector的重塑矩阵问题。但是在vector中,每一个新的vector都会动态的分配一个空间,所以前一个vector和后一个vector不可能会在一个内存空间中。想法1宣告失败。只能将vector中的值赋予数组中,再进行操作。 //基原创 2017-11-12 15:07:21 · 189 阅读 · 0 评论 -
Submission Details
Submission Details第5天 第11题题目You're now a baseball game point recorder.Given a list of strings, each string can be one of the 4 following types:1.Integer (one round's score): Directly represents the nu原创 2017-11-08 20:13:28 · 198 阅读 · 0 评论 -
DistributeCandies
Distribute Candies第5天 第10题Given an integer array with even length, where different numbers in this array represent different kinds of candies. Each number means one candy of the corresponding kind. You原创 2017-11-08 12:32:08 · 240 阅读 · 2 评论 -
KeyboardRow
Keyboard Row第四天第7题题目Given a List of words, return the words that can be typed using letters of alphabet on only one row’s of American keyboard like the image below. Example 1:Input: [“Hello”, “Alaska”原创 2017-11-07 20:14:34 · 173 阅读 · 0 评论 -
MergeTwoBinaryTrees
Merge Two Binary Trees第二天题目Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not.You need to merge the原创 2017-11-07 18:38:19 · 145 阅读 · 0 评论 -
hammingDistance
Hamming Distance根据位的运算计算得到: 与:0010&0011得到0010; 4&1=0000 0000 0000 0000 0000 0000 0000 0000 或:4|1=0000 0000 0000 0000 0000 0000 0000 1001 异或:5=0000 0000 0000 0101^7=0000 0000 0000 0111 = 0000 0000 0原创 2017-11-05 14:31:02 · 186 阅读 · 0 评论 -
226.InvertABinaryTree
226. Invert Binary TreeInvert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1/** * Definition for a binary tree node. * struct TreeN原创 2017-11-24 17:43:54 · 136 阅读 · 0 评论