![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Leetcode
LYZ0907
SHOW YOUR CODE.
展开
-
Leetcode题目汇总-Java实现
Leetcode高频题目(100)汇总-Java实现原创 2017-10-17 08:52:51 · 1212 阅读 · 0 评论 -
【Leetcode-Medium-22】Generate Parentheses
【Leetcode-Easy-22】Generate Parentheses题目Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[ “((()))”,原创 2017-10-21 19:49:26 · 1304 阅读 · 0 评论 -
【Leetcode-Medium-583】Delete Operation for Two Strings
【Leetcode-Medium-583】Delete Operation for Two Strings题目Given two words word1 and word2, find the minimum number of steps required to make word1 and word2 the same, where in each step you can delete one原创 2017-10-20 22:02:12 · 929 阅读 · 0 评论 -
【Leetcode-Medium-547】Friend Circles
Leetcode-Medium-547】Friend CirclesTODO: 对比2017-09-12去哪儿校招真题”六度人脉,最大的度”题目There are N students in a class. Some of them are friends, while some are not. Their friendship is transitive in nature. For exa原创 2017-10-20 21:38:33 · 715 阅读 · 0 评论 -
【Leetcode-Medium-647】Palindromic Substrings
【Leetcode-Medium-647】Palindromic Substrings题目Given a string, your task is to count how many palindromic substrings in this string.The substrings with different start indexes or end indexes are counted原创 2017-10-20 20:06:57 · 764 阅读 · 0 评论 -
【Leetcode-Medium-494】Target Sum
【Leetcode-Medium-494】Target Sum题目You are given a list of non-negative integers, a1, a2, …, an, and a target, S. Now you have 2 symbols + and -. For each integer, you should choose one from + and - as i原创 2017-10-19 19:44:07 · 764 阅读 · 0 评论 -
【Leetcode-Medium-46】Permutations
【Leetcode-Medium-46】Permutations题目Given a collection of distinct numbers, return all possible permutations.For example, [1,2,3] have the following permutations: [ [1,2,3], [1,3,2], [2,1,3],原创 2017-10-19 19:19:13 · 535 阅读 · 0 评论 -
【Leetcode-Medium338】Counting Bits
【Leetcode-Medium338】Counting Bits题目Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1’s in their binary representation and return them as an原创 2017-10-19 19:06:28 · 886 阅读 · 0 评论 -
【Leetcode-Easy-155】 Min Stack
【Leetcode-Easy-155】 Min Stack题目Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) – Push element x onto stack. pop() – Removes the element on top原创 2017-10-19 15:27:11 · 655 阅读 · 0 评论 -
【Leetcode-Easy-160】Intersection of Two Linked Lists
【Leetcode-Easy-160】Intersection of Two Linked Lists题目Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A:原创 2017-10-19 15:06:57 · 591 阅读 · 0 评论 -
Leetcode100题
Leetcode100题【Leetcode-Easy-110】Balanced Binary Tree题目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 dep原创 2017-10-16 20:00:07 · 591 阅读 · 0 评论 -
【Leetcode-Easy-234】Palindrome Linked List
【Leetcode-Easy-234】Palindrome Linked List题目Given a singly linked list, determine if it is a palindrome.Follow up: Could you do it in O(n) time and O(1) space?思路双指针找到链表的中间结点; 反转链表的后半部分; 比较链表的前半部分和“后半原创 2017-10-19 15:06:04 · 589 阅读 · 0 评论 -
【Leetcode-Medium-238】Product of Array Except Self
【Leetcode-Easy-238】Product of Array Except Self题目Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nu原创 2017-10-20 21:11:45 · 648 阅读 · 0 评论 -
【Leetcode-Medium-94】Binary Tree Inorder Traversal
【Leetcode-Medium-94】Binary Tree Inorder Traversal题目Given a binary tree, return the inorder traversal of its nodes’ values.For example: Given binary tree [1,null,2,3], 1 \ 2 / 3retur原创 2017-10-21 20:27:10 · 1127 阅读 · 0 评论 -
【Leetcode-Hard-124】Binary Tree Maximum Path Sum
【Leetcode-Hard-124】Binary Tree Maximum Path Sum题目Given a 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 t原创 2017-10-21 21:13:11 · 744 阅读 · 0 评论 -
【Leetcode-easy-572】Subtree of Another Tree
【Leetcode-easy-572】Subtree of Another Tree题目Given two non-empty binary trees s and t, check whether tree t has exactly the same structure and node values with a subtree of s. A subtree of s is a tree c原创 2017-10-16 21:37:14 · 634 阅读 · 0 评论 -
【Leetcode-easy-543】Diameter of Binary Tree
【Leetcode-easy-543】Diameter of Binary Tree题目Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of the longest path between any原创 2017-10-16 19:43:07 · 719 阅读 · 0 评论 -
【Leetcode-easy-104】Maximum Depth of Binary Tree
【Leetcode-easy-104】Maximum Depth of Binary Tree题目Given a binary 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原创 2017-10-14 22:20:21 · 646 阅读 · 0 评论 -
【Leetcode-easy-136】Single Number
【Leetcode-easy-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 i原创 2017-10-14 22:10:31 · 690 阅读 · 0 评论 -
【Leetcode-easy-226】Invert Binary Tree
【Leetcode-easy-226】Invert Binary Tree题目Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1Trivia: This problem was inspired by thi原创 2017-10-14 21:56:12 · 645 阅读 · 0 评论 -
【Leetcode-easy-463】Island Perimeter
【Leetcode-easy-463】Island Perimeter题目You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (not原创 2017-10-14 21:40:35 · 718 阅读 · 0 评论 -
【Leetcode-easy-617】Merge Two Binary Trees
【Leetcode-easy-617】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 n原创 2017-10-14 20:21:25 · 907 阅读 · 0 评论 -
【Leetcode-medium-150】Evaluate Reverse Polish Notation
【Leetcode-medium-150】Evaluate Reverse Polish Notation题目Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or anothe原创 2017-10-14 19:41:52 · 839 阅读 · 0 评论 -
【Leetcode-easy-111】Minimum Depth of Binary Tree
【Leetcode-easy-111】Minimum Depth of Binary Tree题目Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf原创 2017-10-14 19:21:43 · 759 阅读 · 0 评论 -
【Leetcode-hard-146】LRU Cache
【Leetcode-hard-146】LRU Cache题目Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and put.get(key) - Get the value (will always be原创 2017-10-14 13:49:05 · 943 阅读 · 0 评论 -
LeetCode高频题目(100)汇总-Java实现
LeetCode高频题目(100)汇总-Java实现目录第01-50题【Leetcode-easy-1】 Two Sum【Leetcode-easy-2】 Add Two Numbers【Leetcode-easy-3】 Longest Substring Without Repeating Characters【Leetcode-easy-5】 Longest Palindromic Substr原创 2017-08-23 19:03:06 · 11689 阅读 · 0 评论 -
【Leetcode-Easy-20】 Valid Parentheses
【Leetcode-Easy-20】 Valid Parentheses题目Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is valid.The brackets must close in the correct order,原创 2017-10-19 15:05:12 · 924 阅读 · 0 评论 -
【Leetcode-Easy-141】Linked List Cycle
【Leetcode-Easy-141】Linked List Cycle题目Given a linked list, determine if it has a cycle in it.Follow up: Can you solve it without using extra space?思路快指针和慢指针程序/** * Definition for singly-linked list.原创 2017-10-19 15:03:27 · 584 阅读 · 0 评论 -
Leetcode-easy题目总结-Java实现
Leetcode-easy题目总结-Java实现001组xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx002组xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx原创 2017-09-23 20:32:29 · 576 阅读 · 0 评论 -
【LeetCode】011 Container With Most Water
【LeetCode】011 Container With Most Water题目Given n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line原创 2017-08-23 21:34:19 · 967 阅读 · 0 评论 -
【LeetCode】005 Longest Palindromic Substring 最长的回文子字符串
【LeetCode】005 Longest Palindromic Substring 最长的回文子字符串题目Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example:Input: “babad”Output: “原创 2017-08-23 20:45:47 · 1316 阅读 · 1 评论 -
【LeetCode】003 Longest Substring Without Repeating Characters 最长的没有重复的子字符串
【LeetCode】003 Longest Substring Without Repeating Characters题目Given a string, find the length of the longest substring without repeating characters.Examples:Given “abcabcbb”, the answer is “abc”, which原创 2017-08-23 19:13:19 · 1492 阅读 · 0 评论 -
【Leetcode】71 Simplify path 简化路径
Simplify path1. 题目——来自leetcode Given an absolute path for a file (Unix-style), simplify it. For example, path = “/home/”, => “/home” path = “/a/./b/../../c/原创 2017-04-06 16:53:57 · 724 阅读 · 0 评论 -
【Leetcode】Binary Tree Paths 二叉树根结点到所有叶子结点的路径
Leetcode Binary Tree Paths 二叉树根结点到所有叶子结点的路径package ac.leetcode.tree;import org.junit.Test;import java.util.LinkedList;import java.util.List;/** * description: * * @author liyazhou * @since 2017-07原创 2017-07-02 14:18:17 · 417 阅读 · 0 评论 -
【Leetcode】257 Binary Tree Paths 二叉树的路径
【Leetcode】257 Binary Tree Paths题目Given a binary tree, return all root-to-leaf paths.For example, given the following binary tree: 1 / \2 3 \ 5All root-to-leaf paths are: [“1->2->5”, “1->原创 2017-08-10 15:59:53 · 350 阅读 · 0 评论 -
【Leetcode】002 Add Two Numbers
【Leetcode】002 Add Two Numbers题目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. Ad原创 2017-08-09 21:12:57 · 2377 阅读 · 0 评论 -
【Leetcode-13】罗马数字转换为阿拉伯数字
题目罗马数字转换为阿拉伯数字思路程序package leetcode.subjects;import org.junit.Test;import java.util.HashMap;/** * description: * * @author liyazhou * @since 2017-09-20 21:58 */public class RomanToInt { @Test原创 2017-09-20 22:18:22 · 499 阅读 · 0 评论 -
【Leetcode-easy-448】Find All Numbers Disappeared in an Array
【Leetcode-easy-448】Find All Numbers Disappeared in an Array题目Given 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 o原创 2017-10-18 08:45:13 · 519 阅读 · 0 评论 -
【Leetcode-Easy-110】Balanced Binary Tree
【Leetcode-Easy-110】Balanced Binary Tree题目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 tw原创 2017-10-19 15:01:44 · 692 阅读 · 0 评论 -
【Leetcode-Easy-581】Shortest Unsorted Continuous Subarray
【Leetcode-Easy-581】Shortest Unsorted Continuous Subarray题目Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array w原创 2017-10-19 14:51:54 · 631 阅读 · 0 评论