leetcode solution cracked tutorial】的更多相关文章

leetcode solution cracked tutorial problemset https://leetcode.com/problemset/all/ Top Interview Questions https://leetcode.com/problemset/all/?listId=wpwgkgt free solution hack ways leetcode solutions 破解教程 https://github.com/xgqfrms/leetcode/issues/…
Problem Statement Given a pattern and a string str, find if str follows the same pattern. Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty substring in str. Example 1: Input: pattern = "abab&q…
Problem Statement Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occurrences of a character must be replaced with another character while preserving the ord…
Problem Statement Given a pattern and a string str, find if str follows the same pattern. Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in str. Example 1: Input: pattern = "abba",…
Problem Statement Implement a basic calculator to evaluate a simple expression string. The expression string contains only non-negative integers, +, -, *, / operators and empty spaces . The integer division should truncate toward zero. Example 1: Inp…
Problem Statement Given a non-empty binary tree, find the maximum path sum. For this problem, a path is defined as any sequence of nodes from some starting node to any node in the tree along the parent-child connections. The path must contain at leas…
Problem Statement In a 1 million by 1 million grid, the coordinates of each grid square are (x, y) with 0 <= x, y < 10^6. We start at the source square and want to reach the target square.  Each move, we can walk to a 4-directionally adjacent square…
题目链接:Path Sum II | LeetCode OJ Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. For example: Given the below binary tree and sum = 22, 5 / \ 4 8 / / \ 11 13 4 / \ / \ 7 2 5 1 return [ [5,4,11,2],…
题目链接:Path Sum | LeetCode OJ 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 path equals the given sum. For example: Given the below binary tree and sum = 22, 5 / \ 4 8 / / \ 11…
题目链接:Balanced Binary Tree | LeetCode OJ Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never differ by more tha…
题目链接:Same Tree | LeetCode OJ 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. Tags: Depth-first Search 分析 很基本的一道深度优…
题目链接:Recover Binary Search Tree | LeetCode OJ Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure. Note: A solution using O(n) space is pretty straight forward. Could you devise a constan…
题目链接:Validate Binary Search Tree | LeetCode OJ Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contains only nodes with keys less than the node's key. The right…
题目链接:Symmetric Tree | LeetCode OJ Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \ 3 4 4 3 But the following is not: 1 / \ 2 2 \ \ 3 3 Note: B…
题目链接:Sudoku Solver | LeetCode OJ Write a program to solve a Sudoku puzzle by filling the empty cells. Empty cells are indicated by the character '.'. You may assume that there will be only one unique solution. A sudoku puzzle... ...and its solution n…
题目链接:Valid Sudoku | LeetCode OJ Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules. The Sudoku board could be partially filled, where empty cells are filled with the character '.'. A partially filled sudoku which is valid. Note:…
题目链接:Populating Next Right Pointers in Each Node II | LeetCode OJ Follow up for problem "Populating Next Right Pointers in Each Node". What if the given tree could be any binary tree? Would your previous solution still work? Note: You may only u…
题目链接:Populating Next Right Pointers in Each Node | LeetCode OJ Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; } Populate each next pointer to point to its next right node. If there is no next ri…
August 2, 2015 在http://zzk.cnblogs.com/ 用"找一找", 花了几个小时, 找出比较好的Leetcode博客. Read the leetcode question and solutions: 1. Find lowest common ancestor in binary tree: blog of a facebook programmer working on leetcode questions: 递归版本:空间O(1),时间O(n) ht…
请点击页面左上角 -> Fork me on Github 或直接访问本项目Github地址:LeetCode Solution by Swift    说明:题目中含有$符号则为付费题目. 如:[Swift]LeetCode156.二叉树的上下颠倒 $ Binary Tree Upside Down 请下拉滚动条查看最新 Weekly Contest!!! Swift LeetCode 目录 | Catalog 序        号 题名Title 难度     Difficulty  两数之…
前言 现如今,对于技术人员(软开.算法等)求职过程中笔试都是必不可少的(免笔试的除外,大部分人都需要笔试),而笔试一般组成都是选择.填空.简答题.编程题(这部分很重要),所以刷题是必不可少的:对于应届生求职来说更是需要疯狂的刷题,因为平时都有自己的科研任务,但是个人还是建议刷题应该循序渐进的,提前准备,这样就可以比较轻松地应对编程题这一部分了,而不用每天只集中在刷题这件事上:对于已经工作的人也不是说不再需要刷题了,即使是跳槽也会有算法题的考核,所以无论对于应届生还是在职人员,找工作都需要一定的算…
一.拼写单词(LeetCode-1160) 1.1 题目描述 1.2 解题思路 由于给定的chars,每个字母只能用一次,所以用大小为26的数组charsArray来表示a-z(例如charsArray[0]代表字符a可以使用的次数,charsArray[25]代表字符z可以使用的次数),存放某字符的可使用的个数. 遍历单词列表,复制一份charsArray,使用一次,就将单词可使用次数减1. 若需要用到的字符时,该在charsArray的数量为0,则该单词不符合条件. 1.3 实现代码 cla…
博客园markdown太烂, 题解详情https://github.com/TangliziGit/leetcode/blob/master/solution/11-20.md Leetcode Solution 11~20 marks: @: hard to get a direct solution %: need optimization 好题 %%% 11. Container With Most Water[Medium] %%%%% 15. 3Sum[Medium] %%% 16.…
博客园markdown太烂, 题解详见https://github.com/TangliziGit/leetcode/blob/master/solution/1-10.md Leetcode Solution 0~10 marks: @: hard to get a direct solution %: need optimization 好题 @@@@@ 4. Median of Two Sorted Arrays [Hard] % 5. Longest Palindromic Substr…
题目标签: 题目给了我们 courses 表格,让我们找到 一个有至少5名学生的班级. 利用group by 把班级分类,在用Having count 来判断是否有5名,注意这里还需要用 distinct 来判断是否有重复的学生在同一个班级里. Java Solution: Runtime:  205 ms, faster than 51.77% Memory Usage: N/A 完成日期:07/02/2019 关键点:GROUP BY && HAVING count # Write y…
题目标签: 题目给了我们一个 温度表格,让我们找到 所有温度比之前一天高的,返回id. 建立 Weather w1, Weather w2,找到当w1 的温度 大于 w2 的时候,而且 w1 的日期是在w2 的后一天,返回id. Java Solution: Runtime:  338 ms, faster than 66 % Memory Usage: N/A 完成日期:06/01/2019 关键点:利用TO_DAYS 来比较日期. # Write your MySQL query state…
题目标签: 题目给了我们一个 email 的表格,让我们删除重复的. 建立Person p1,Person p2,当email 相同时,而且 p1 id 要大于 p2 id 时候,删除这一行. Java Solution: Runtime:  869 ms, faster than 33 % Memory Usage: N/A 完成日期:06/01/2019 关键点:p1.Id > p2.Id # Write your MySQL query statement below DELETE p1…
题目标签: 题目给了我们一个 员工表,包括经理.员工会有经理的id. 这里可以重复 利用两次 表格,表格a, 表格b,当a 员工的经理id  等于 b员工时候,在从中找到员工工资大于经理的.具体看code. Java Solution: Runtime:  312 ms, faster than 65 % Memory Usage: N/A 完成日期:05/22/2019 关键点:From 员工表a,b # Write your MySQL query statement below SELEC…
题目标签: 题目给了我们一个工资表,让我们返回第二高的工资. 利用Max,把第一高的工资找到,然后利用 NOT IN,去找到第二高的工资. Java Solution: Runtime:  153ms, faster than 44 % 完成日期:05/22/2019 关键点:MAX, NOT IN # Write your MySQL query statement below SELECT Max(Salary) As SecondHighestSalary FROM Employee WH…
题目标签: 题目给了我们两个table,让我们合并,根据Person为主. 因为题目说了 提供person 信息,不管这个人有没有地址.所以这里用Left Join. Java Solution: Runtime:  244 ms, faster than 40 % 完成日期:05/22/2019 关键点:Left Join # Write your MySQL query statement below Select FirstName, LastName, City, State From…