Fork me on GitHub

随笔分类 -  LeetCode

摘要:/** * * @author gentleKay * Given a binary tree, determine if it is height-balanced. * For this problem, a height-balanced binary tree is defined as a 阅读全文
posted @ 2019-07-29 17:51 gentleKay 阅读(205) 评论(0) 推荐(0)
摘要:/** * * @author gentleKay * A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). * The robot can only move 阅读全文
posted @ 2019-07-29 10:46 gentleKay 阅读(226) 评论(0) 推荐(0)
摘要:/** * * @author gentleKay * Find the contiguous subarray within an array (containing at least one number) which has the largest sum. * For example, gi 阅读全文
posted @ 2019-07-29 10:26 gentleKay 阅读(180) 评论(0) 推荐(0)
摘要:/** * * @author gentleKay * Given a binary tree * Populate each next pointer to point to its next right node. If there is no next right node, the next 阅读全文
posted @ 2019-07-26 15:21 gentleKay 阅读(205) 评论(0) 推荐(0)
摘要:/** * * @author gentleKay * Given a roman numeral, convert it to an integer. * Input is guaranteed to be within the range from 1 to 3999. * * 给定一个罗马数字 阅读全文
posted @ 2019-07-26 15:12 gentleKay 阅读(133) 评论(0) 推荐(0)
摘要:/** * * @author gentleKay * Given two binary trees, write a function to check if they are equal or not. * Two binary trees are considered equal if the 阅读全文
posted @ 2019-07-26 15:09 gentleKay 阅读(142) 评论(0) 推荐(0)
摘要:/** * @author gentleKay * Determine whether an integer is a palindrome. Do this without extra space. * click to show spoilers. * Some hints: * Could n 阅读全文
posted @ 2019-07-25 15:55 gentleKay 阅读(147) 评论(0) 推荐(0)
摘要:/** * * @author gentleKay * Say you have an array for which the i th element is the price of a given stock on day i. * If you were only permitted to c 阅读全文
posted @ 2019-07-25 15:54 gentleKay 阅读(197) 评论(0) 推荐(0)
摘要:/** * * @author gentleKay * Given a linked list, determine if it has a cycle in it. * Follow up: * Can you solve it without using extra space? * * 给定一 阅读全文
posted @ 2019-07-24 15:11 gentleKay 阅读(209) 评论(0) 推荐(0)
摘要:/** * * @author gentleKay * Given an integer, convert it to a roman numeral. * Input is guaranteed to be within the range from 1 to 3999. * * 给定一个整数,将 阅读全文
posted @ 2019-07-24 15:10 gentleKay 阅读(225) 评论(0) 推荐(0)
摘要:/** * @author gentleKay * Given n non-negative integers a1 , a2 , ..., an , where each represents a point at coordinate (i, ai ). * n vertical lines a 阅读全文
posted @ 2019-07-24 15:09 gentleKay 阅读(158) 评论(0) 推荐(0)
摘要:/** * * @author gentleKay * Reverse digits of an integer. * Example1: x = 123, return 321 * Example2: x = -123, return -321 * click to show spoilers. 阅读全文
posted @ 2019-07-24 10:51 gentleKay 阅读(166) 评论(0) 推荐(0)
摘要:/** * @author gentleKay * Say you have an array for which the i th element is the price of a given stock on day i. * Design an algorithm to find the m 阅读全文
posted @ 2019-07-24 10:47 gentleKay 阅读(154) 评论(0) 推荐(0)
摘要:/** * @author gentleKay * 题目描述 * Given an array of integers, every element appears twice except for one. Find that single one. * Note: * Your algorith 阅读全文
posted @ 2019-07-23 14:53 gentleKay 阅读(195) 评论(0) 推荐(0)
摘要:/** * @author gentleKay * 题目描述 * Given a binary tree, find its maximum depth. * The maximum depth is the number of nodes along the longest path from t 阅读全文
posted @ 2019-07-23 14:50 gentleKay 阅读(173) 评论(0) 推荐(0)
摘要:题目描述 Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are+,-,*,/. Each operand may be an integer or another 阅读全文
posted @ 2019-07-22 16:25 gentleKay 阅读(175) 评论(0) 推荐(0)
摘要:题目描述 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 neare 阅读全文
posted @ 2019-07-22 16:22 gentleKay 阅读(243) 评论(0) 推荐(0)