随笔分类 -  Leetcode

上一页 1 2 3 4 5 6 7 8 9 ··· 12 下一页
leetcode 748. Shortest Completing Word
摘要:Find the minimum length word from a given dictionary words, which has all the letters from the string licensePlate. Such a word is said to complete th 阅读全文
posted @ 2017-12-17 13:40 Beserious 阅读(744) 评论(0) 推荐(0) 编辑
leetcode 746. Min Cost Climbing Stairs
摘要:Once you pay the cost, you can either climb one or two steps. You need to find minimum cost to reach the top of the floor, and you can either start fr 阅读全文
posted @ 2017-12-17 13:39 Beserious 阅读(282) 评论(0) 推荐(0) 编辑
leetcode 343 Integer Break
摘要:Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum pro 阅读全文
posted @ 2017-12-14 18:34 Beserious 阅读(199) 评论(0) 推荐(0) 编辑
leetcode 680. Valid Palindrome II
摘要:"原文" Given a non empty string s, you may delete at most one character. Judge whether you can make it a palindrome. 一道不错的题目。题目大意是最多删除一个字母,使得原来的字符串是回文串。 阅读全文
posted @ 2017-11-19 22:13 Beserious 阅读(124) 评论(0) 推荐(0) 编辑
leetcode 50. Pow(x, n)
摘要:Implement pow(x, n). 快速幂直接搞,注意边界。 class Solution { public: double pow(double a, long long n) { double tmp = 1.0; if (a == 1) return 1; if (n == 0) ret 阅读全文
posted @ 2017-11-12 23:50 Beserious 阅读(125) 评论(0) 推荐(0) 编辑
leetcode 354. Russian Doll Envelopes
摘要:You have a number of envelopes with widths and heights given as a pair of integers (w, h). One envelope can fit into another if and only if both the w 阅读全文
posted @ 2017-11-08 23:44 Beserious 阅读(128) 评论(0) 推荐(0) 编辑
leetcode 718. Maximum Length of Repeated Subarray
摘要:Given two integer arrays A and B, return the maximum length of an subarray that appears in both arrays. Example 1: Input: A: [1,2,3,2,1] B: [3,2,1,4,7 阅读全文
posted @ 2017-10-31 13:42 Beserious 阅读(199) 评论(0) 推荐(0) 编辑
leetcode 443. String Compression
摘要:Given an array of characters, compress it in place. The length after compression must always be smaller than or equal to the original array. Every ele 阅读全文
posted @ 2017-10-31 13:40 Beserious 阅读(761) 评论(0) 推荐(0) 编辑
leetcode 717. 1-bit and 2-bit Characters
摘要:We have two special characters. The first character can be represented by one bit 0. The second character can be represented by two bits (10 or 11). N 阅读全文
posted @ 2017-10-31 13:37 Beserious 阅读(295) 评论(0) 推荐(0) 编辑
leetcode 48. Rotate Image
摘要:You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Note: You have to rotate the image in place, which 阅读全文
posted @ 2017-10-23 09:45 Beserious 阅读(130) 评论(0) 推荐(0) 编辑
leetcode 19. Remove Nth Node From End of List
摘要:Given a linked list, remove the nth node from the end of list and return its head. For example, Note: Given n will always be valid. Try to do this in 阅读全文
posted @ 2017-10-22 14:13 Beserious 阅读(124) 评论(0) 推荐(0) 编辑
leetcode 692. Top K Frequent Words
摘要:Given a non empty list of words, return the k most frequent elements. Your answer should be sorted by frequency from highest to lowest. If two words h 阅读全文
posted @ 2017-10-21 19:10 Beserious 阅读(320) 评论(0) 推荐(0) 编辑
leetcode 36. Valid Sudoku
摘要: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 阅读全文
posted @ 2017-10-20 14:37 Beserious 阅读(102) 评论(0) 推荐(0) 编辑
leetcode 416. Partition Equal Subset Sum
摘要:Given a non empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both 阅读全文
posted @ 2017-10-20 14:00 Beserious 阅读(92) 评论(0) 推荐(0) 编辑
leetcode 696. Count Binary Substrings
摘要:Give a string s, count the number of non empty (contiguous) substrings that have the same number of 0's and 1's, and all the 0's and all the 1's in th 阅读全文
posted @ 2017-10-16 17:08 Beserious 阅读(250) 评论(0) 推荐(0) 编辑
leetcode 74. Search a 2D Matrix
摘要:Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted f 阅读全文
posted @ 2017-10-11 13:33 Beserious 阅读(86) 评论(0) 推荐(0) 编辑
leetcode 199. Binary Tree Right Side View
摘要:Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. 阅读全文
posted @ 2017-10-11 10:41 Beserious 阅读(101) 评论(0) 推荐(0) 编辑
leetcode 43. Multiply Strings
摘要:Given two non negative integers num1 and num2 represented as strings, return the product of num1 and num2. Note: The length of both num1 and num2 is v 阅读全文
posted @ 2017-10-10 22:56 Beserious 阅读(96) 评论(0) 推荐(0) 编辑
leetcode 257. Binary Tree Paths
摘要:Given a binary tree, return all root to leaf paths. 题目大意: 输出二叉树的所有路径 思路: 先序遍历,记录路径。为了回溯,临时存储路径的数据结构得具有弹出最后一个元素的功能,我的代码里面用的是vector 阅读全文
posted @ 2017-10-10 22:54 Beserious 阅读(110) 评论(0) 推荐(0) 编辑
leetcode 695. Max Area of Island
摘要:Given a non empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4 directionally (horizontal or vertical.) Yo 阅读全文
posted @ 2017-10-10 22:54 Beserious 阅读(312) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 8 9 ··· 12 下一页