leecode刷题
佚明zj
此人不懒,什么也没留下
展开
-
leetcode刷题atoi
class Solution {public: int myAtoi(string str) { int flag = 1; long result =0; int num = str.length(); int start = str.find_first_not_of(' '); if(sta...原创 2019-06-12 15:15:31 · 118 阅读 · 0 评论 -
leetcode Two Sum
Given an array of integers, returnindicesof the two numbers such that they add up to a specific target.You may assume that each input would haveexactlyone solution, and you may not use thesame...原创 2019-04-04 18:45:15 · 122 阅读 · 0 评论 -
leetcode第六题 recovertree 递归中序
Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Example 1:Input: [1,3,null,null,2] 1 /3 \ 2Output: [3,1,null,...原创 2019-03-18 15:42:31 · 146 阅读 · 0 评论 -
leetcode第五题 sametree 深度搜索
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 structurally identical and the nodes have the same value.Example ...原创 2019-03-18 13:57:59 · 107 阅读 · 0 评论 -
leetcode第四题(383. Ransom Note)
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 the magazines ; ot...原创 2018-11-07 17:02:55 · 231 阅读 · 0 评论 -
leetcode第三题35:search insert position
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the array....原创 2018-10-25 13:58:06 · 98 阅读 · 0 评论 -
leetcode第一题:滑雪问题
Michael喜欢滑雪百这并不奇怪, 因为滑雪的确很刺激。可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或者等待升降机来载你。Michael想知道载一个区域中最长底滑坡。区域由一个二维数组给出。数组的每个数字代表点的高度。下面是一个例子 1 2 3 4 516 17 18 19 615 24 25 20 714 23 22 21 813 1...原创 2018-10-22 18:26:29 · 4748 阅读 · 0 评论 -
leetcode刷题Valid Parentheses
Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.An input string is valid if:Open brackets must be closed by the same type of b...原创 2019-06-14 10:34:12 · 153 阅读 · 0 评论