LeetCode
你看见我的代码了么
愿世界没有bug
展开
-
Remove Duplicates from Sorted Array [LeetCode]
Remove Duplicates from Sorted ArrayAnalysis 周末下午日常刷题啦~ 下周末或者下下周一表妹就要来上海玩啦,所以下周末可能就没时间刷题了,但是寒假会有很多时间刷题哦~ Given a sorted array, remove the duplicates in-place such that each element appear原创 2018-01-21 16:32:41 · 106 阅读 · 0 评论 -
Valid Parentheses[LeetCode]
Valid Parentheses[LeetCode]Analysis 周末下午日常刷题啦~ 马上就要放寒假了,期待ing Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is valid. Th原创 2018-01-14 15:54:44 · 105 阅读 · 0 评论 -
[leetcode]27 Remove Element
[leetcode]27 Remove Element转载记得注明出处哦~Analysis 很久很久很久没刷题,我以为寒假我会刷题,但是并没有可以说是很放肆了,然后呢最近因为采访一个拿到offer的学长,学长说刷题很重要!!所以决定题还是要刷的。另外学长也超帅的,哇,对大神总是有一种崇拜 —— [ 莫名其妙的心情记录hiahia~ ]Given an array ...原创 2018-03-19 22:48:33 · 82 阅读 · 0 评论 -
[leetcode]28. Implement strStr()
[leetcode]28. Implement strStr()Analysis google是一种信仰 —— [ 想吃炒菠菜! ]Implement strStr(). Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of hay...原创 2018-03-21 16:04:26 · 93 阅读 · 0 评论 -
[leetcode]35. Search Insert Position
[leetcode]35. Search Insert PositionAnalysis 做实验啊做实验!!!! —— [ ummm 可能遇见了一个有趣的人? ]Given a sorted array and a target value, return the index if the target is found. If not, return the in...原创 2018-04-02 22:57:53 · 106 阅读 · 0 评论 -
[leetcode]53. Maximum Subarray
[leetcode]53. Maximum SubarrayAnalysis 内心毫无波动 —— [ 小声逼逼 ]Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the...原创 2018-04-10 20:46:11 · 78 阅读 · 0 评论 -
[leetcode]58. Length of Last Word
[leetcode]58. Length of Last WordAnalysis 内心毫无波动+1 —— [ 小声逼逼 ]Given a string s consists of upper/lower-case alphabets and empty space characters ’ ‘, return the length of last word in t...原创 2018-04-12 14:51:25 · 72 阅读 · 0 评论 -
67. Add Binary
[leetcode]67. Add BinaryAnalysis 昨晚下了好大的雨呀,小伙伴今早说昨晚雷声很大,但是完全没听见,可以说是 婴儿般的睡眠了—— [ 坚持刷题+1 ]Given two binary strings, return their sum (also a binary string). The input strings are both no...原创 2018-05-25 11:33:40 · 76 阅读 · 0 评论 -
# [leetcode]69. Sqrt(x)
[leetcode]69. Sqrt(x)Analysis 刷题and学英语—— [ 坚持坚持]Implement int sqrt(int x). Compute and return the square root of x, where x is guaranteed to be a non-negative integer. Since the return t...原创 2018-05-26 15:38:28 · 127 阅读 · 0 评论 -
[leetcode]70. Climbing Stairs
[leetcode]70. Climbing StairsAnalysis 刷题and学英语—— [ 坚持坚持]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 disti...原创 2018-05-26 15:56:12 · 56 阅读 · 0 评论 -
[leetcode]83. Remove Duplicates from Sorted List
[leetcode]83. Remove Duplicates from Sorted ListAnalysis 刷题and学英语and学算法—— [坚持吖~]Given a sorted linked list, delete all duplicates such that each element appear only once. 这道题是链表的一个简单应用,就是...原创 2018-05-27 15:39:16 · 70 阅读 · 0 评论 -
[leetcode]88. Merge Sorted Array
[leetcode]88. Merge Sorted ArrayAnalysis 刷题and学英语and学算法—— [坚持吖~]Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. 这道题比较简单,就是把两个排好序的数组合并一下。Impl...原创 2018-05-27 16:39:11 · 58 阅读 · 0 评论 -
[leetcode]100. Same Tree
[leetcode]100. Same TreeAnalysis 刷题and学英语and学算法—— [坚持吖~]Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the same if they are...原创 2018-05-28 14:06:11 · 91 阅读 · 0 评论 -
[leetcode]101. Symmetric Tree
[leetcode]101. Symmetric TreeAnalysis 刷题and学英语and学算法—— [坚持吖~]Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). 这题跟上面那题差不多,这个是判断一个树是否对称,同样用递归实现...原创 2018-05-28 14:57:12 · 75 阅读 · 0 评论 -
[leetcode]136. Single Number
[leetcode]136. Single NumberAnalysis 新的一周开始啦~—— [坚持吖~]Given a non-empty array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should h...原创 2018-06-04 16:25:45 · 100 阅读 · 0 评论 -
[leetcode]104. Maximum Depth of Binary Tree
[leetcode]104. Maximum Depth of Binary TreeAnalysis 刷题and学英语and学算法—— [坚持吖~]Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path fro...原创 2018-05-28 16:40:28 · 85 阅读 · 0 评论 -
[leetcode]107. Binary Tree Level Order Traversal II
[leetcode]107. Binary Tree Level Order Traversal IIAnalysis 组会又被怼了—— [哎~]Given a binary tree, return the bottom-up level order traversal of its nodes’ values. (ie, from left to right, leve...原创 2018-05-29 16:25:39 · 83 阅读 · 0 评论 -
[leetcode]108. Convert Sorted Array to Binary Search Tree
[leetcode]108. Convert Sorted Array to Binary Search TreeAnalysis 组会又被怼了—— [哎~]Given an array where elements are sorted in ascending order, convert it to a height balanced BST. For this...原创 2018-05-29 16:54:58 · 64 阅读 · 0 评论 -
[leetcode]155. Min Stack
[leetcode]155. Min StackAnalysis 周末要吃鸡~—— [坚持吖~]Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) – Push element x onto stack. pop...原创 2018-06-05 16:30:41 · 97 阅读 · 0 评论 -
[leetcode]160. Intersection of Two Linked Lists
[leetcode]160. Intersection of Two Linked ListsAnalysis 周末要吃鸡~—— [坚持吖~]Write a program to find the node at which the intersection of two singly linked lists begins. 判断两个链表是否相交,如果相交返回相交开始的...原创 2018-06-05 17:19:36 · 75 阅读 · 0 评论 -
[leetcode]141. Linked List Cycle
[leetcode]141. Linked List CycleAnalysis 新的一周开始啦~—— [坚持吖~]Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using extra space? 判断一个链表是否有环,不要使用格...原创 2018-06-05 14:30:37 · 66 阅读 · 0 评论 -
[leetcode]110. Balanced Binary Tree
[leetcode]110. Balanced Binary TreeAnalysis 组会又被怼了—— [哎~]Given a binary tree, determine if it is height-balanced. 判断一个二叉树是否是平衡二叉树~ 这里详细介绍了平衡二叉树的判断: https://www.geeksforgeeks.org/how-to...原创 2018-05-29 17:33:25 · 90 阅读 · 0 评论 -
[leetcode]111. Minimum Depth of Binary Tree
[leetcode]111. Minimum Depth of Binary TreeAnalysis 组会又被怼了—— [哎~]Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the roo...原创 2018-05-29 17:36:47 · 95 阅读 · 0 评论 -
[leetcode]66. Plus One
[leetcode]66. Plus OneAnalysis paper终于提交啦,但是过的可能性很小的感觉 —— [ 坚持坚持啊 ]Given a non-empty array of digits representing a non-negative integer, plus one to the integer. The digits are stored...原创 2018-05-24 21:15:10 · 94 阅读 · 0 评论 -
[leetcode]206. Reverse Linked List
[leetcode]206. Reverse Linked ListAnalysis 很久没有这么讨厌一个人了!—— [holy shit~]Reverse a singly linked list. 链表反转。Implement/** * Definition for singly-linked list. * struct ListNode { * ...原创 2018-06-12 19:43:07 · 75 阅读 · 0 评论 -
[leetcode]217. Contains Duplicate
[leetcode]217. Contains DuplicateAnalysis ummmm~—— [ummmm~]Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at ...原创 2018-06-12 19:51:11 · 84 阅读 · 0 评论 -
[leetcode]219. Contains Duplicate II
[leetcode]219. Contains Duplicate IIAnalysis ummmm~—— [ummmm~]Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nu...原创 2018-06-12 20:33:36 · 84 阅读 · 0 评论 -
[leetcode]225. Implement Stack using Queues
[leetcode]225. Implement Stack using QueuesAnalysis ummmm~—— [ummmm~]Implement the following operations of a stack using queues. push(x) – Push element x onto stack. pop() – Removes the ...原创 2018-06-12 21:06:37 · 100 阅读 · 0 评论 -
[leetcode]112. Path Sum
[leetcode]112. Path SumAnalysis 新的一天新的刷题,中午吃什么比较好呢—— [好想好想吃冰淇淋啊~]Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the p...原创 2018-05-30 10:39:04 · 63 阅读 · 0 评论 -
[leetcode]118. Pascal's Triangle
[leetcode]118. Pascal’s TriangleAnalysis 新的一天新的刷题,中午吃什么比较好呢—— [好想好想吃冰淇淋啊~]Given a non-negative integer numRows, generate the first numRows of Pascal’s triangle. 杨辉三角Implementclass S...原创 2018-05-30 11:48:22 · 107 阅读 · 0 评论 -
[leetcode]167. Two Sum II - Input array is sorted
[leetcode]167. Two Sum II - Input array is sortedAnalysis ummmmm~—— [ummmmmm~]Given an array of integers that is already sorted in ascending order, find two numbers such that they add up t...原创 2018-06-06 10:26:06 · 71 阅读 · 0 评论 -
[leetcode]404. Sum of Left Leaves
[leetcode]404. Sum of Left LeavesAnalysis everyday is the first day of your rest life—— [间歇性迷茫~]Find the sum of all left leaves in a given binary tree.计算二叉树的所有左叶子节点的和,递归遍历。Implement...原创 2018-06-20 20:12:19 · 84 阅读 · 0 评论 -
[leetcode]405. Convert a Number to Hexadecimal
[leetcode]405. Convert a Number to HexadecimalAnalysis everyday is the first day of your rest life—— [间歇性迷茫~]Given an integer, write an algorithm to convert it to hexadecimal. 十进制转十六进制。 ...原创 2018-06-20 20:36:00 · 124 阅读 · 0 评论 -
[leetcode]409. Longest Palindrome
[leetcode]409. Longest PalindromeAnalysis everyday is the first day of your rest life—— [间歇性迷茫~]Given a string which consists of lowercase or uppercase letters, find the length of the long...原创 2018-06-20 20:59:56 · 109 阅读 · 0 评论 -
[leetcode]412. Fizz Buzz
[leetcode]412. Fizz BuzzAnalysis everyday is the first day of your rest life—— [间歇性迷茫~]Write a program that outputs the string representation of numbers from 1 to n. But for multiples of ...原创 2018-06-20 21:13:21 · 93 阅读 · 0 评论 -
[leetcode]169. Majority Element
[leetcode]169. Majority ElementAnalysis ummmm~—— [ummmm~]Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You...原创 2018-06-06 11:33:10 · 74 阅读 · 0 评论 -
[leetcode]171. Excel Sheet Column Number
[leetcode]171. Excel Sheet Column NumberAnalysis ummmmm~—— [ummmmmm~]Given a column title as appear in an Excel sheet, return its corresponding column number.很简单的题啦,看输入输出样例基本就能get意思,就不...原创 2018-06-06 11:56:59 · 61 阅读 · 0 评论 -
[leetcode]226. Invert Binary Tree
[leetcode]226. Invert Binary TreeAnalysis 厉害的人总是那么的厉害呀~—— [菜鸡反省中~]Invert a binary tree. 翻转二叉树,递归解决就行了。Implement/** * Definition for a binary tree node. * struct TreeNode { * ...原创 2018-06-13 14:26:52 · 84 阅读 · 0 评论 -
[leetcode]231. Power of Two
[leetcode]231. Power of TwoAnalysis 厉害的人总是那么的厉害呀~—— [菜鸡反省中~]Given an integer, write a function to determine if it is a power of two. 判断一个数是否是2的指数。Implementclass Solution {public: ...原创 2018-06-13 14:37:03 · 69 阅读 · 0 评论 -
[leetcode]232. Implement Queue using Stacks
[leetcode]232. Implement Queue using StacksAnalysis 厉害的人总是那么的厉害呀~—— [菜鸡反省中~]Implement the following operations of a queue using stacks. push(x) – Push element x to the back of queue. pop...原创 2018-06-13 14:49:37 · 108 阅读 · 0 评论