随笔分类 -  Leetcode

上一页 1 2 3 4 5 6 7 8 ··· 12 下一页
leetcode 205. Isomorphic Strings
摘要: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 occurrenc 阅读全文
posted @ 2018-02-28 16:15 Beserious 阅读(104) 评论(0) 推荐(0) 编辑
leetcode 203. Remove Linked List Elements
摘要:Remove all elements from a linked list of integers that have value val. 思路:声明两指针,类似快慢指针,快指针遇到val时跳过,直到值不是val这时修改慢指针的next为快指针,慢指针移到快指针这个位置。 阅读全文
posted @ 2018-02-28 16:00 Beserious 阅读(81) 评论(0) 推荐(0) 编辑
leetcode 198. House Robber
摘要:You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping yo 阅读全文
posted @ 2018-02-28 15:15 Beserious 阅读(105) 评论(0) 推荐(0) 编辑
leetcode 190. Reverse Bits
摘要:Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), retur 阅读全文
posted @ 2018-02-28 15:10 Beserious 阅读(80) 评论(0) 推荐(0) 编辑
leetcode leetcode 783. Minimum Distance Between BST Nodes
摘要:Given a Binary Search Tree (BST) with the root node root, return the minimum difference between the values of any two different nodes in the tree. Not 阅读全文
posted @ 2018-02-28 15:08 Beserious 阅读(296) 评论(0) 推荐(0) 编辑
leetcode 202. Happy Number
摘要:Write an algorithm to determine if a number is "happy". A happy number is a number defined by the following process: Starting with any positive intege 阅读全文
posted @ 2018-02-28 15:07 Beserious 阅读(109) 评论(0) 推荐(0) 编辑
leetcode 389. Find the Difference
摘要:Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s and then add one more letter at 阅读全文
posted @ 2018-02-28 15:03 Beserious 阅读(114) 评论(0) 推荐(0) 编辑
leetcode 594. Longest Harmonious Subsequence
摘要:We define a harmonious array is an array where the difference between its maximum value and its minimum value is exactly 1. Now, given an integer arra 阅读全文
posted @ 2018-02-28 14:54 Beserious 阅读(105) 评论(0) 推荐(0) 编辑
leetcode 151. Reverse Words in a String
摘要:Given an input string, reverse the string word by word. For example, Given s = "the sky is blue", return "blue is sky the". Update (2015 02 12): For C 阅读全文
posted @ 2018-02-28 14:49 Beserious 阅读(83) 评论(0) 推荐(0) 编辑
leetcode 747. Largest Number At Least Twice of Others
摘要:In a given integer array nums, there is always exactly one largest element. Find whether the largest element in the array is at least twice as much as 阅读全文
posted @ 2018-02-28 13:26 Beserious 阅读(108) 评论(0) 推荐(0) 编辑
leetcode 767. Reorganize String
摘要:Given a string S, check if the letters can be rearranged so that two characters that are adjacent to each other are not the same. If possible, output 阅读全文
posted @ 2018-02-28 13:21 Beserious 阅读(292) 评论(0) 推荐(0) 编辑
leetcode 789. Escape The Ghosts
摘要:You are playing a simplified Pacman game. You start at the point (0, 0), and your destination is (target[0], target[1]). There are several ghosts on t 阅读全文
posted @ 2018-02-25 19:07 Beserious 阅读(403) 评论(0) 推荐(0) 编辑
leetcode 791. Custom Sort String
摘要:S and T are strings composed of lowercase letters. In S, no letter occurs more than once. S was sorted in some custom order previously. We want to per 阅读全文
posted @ 2018-02-25 19:06 Beserious 阅读(370) 评论(0) 推荐(0) 编辑
leetcode 788. Rotated Digits
摘要:X is a good number if after rotating each digit individually by 180 degrees, we get a valid number that is different from X. A number is valid if each 阅读全文
posted @ 2018-02-25 19:05 Beserious 阅读(503) 评论(0) 推荐(0) 编辑
leetcode 790. Domino and Tromino Tiling
摘要:We have two types of tiles: a 2x1 domino shape, and an "L" tromino shape. These shapes may be rotated. XX 阅读全文
posted @ 2018-02-25 19:03 Beserious 阅读(809) 评论(0) 推荐(0) 编辑
leetcode 784. Letter Case Permutation
摘要:Given a string S, we can transform every letter individually to be lowercase or uppercase to create another string. Return a list of all possible stri 阅读全文
posted @ 2018-02-23 15:26 Beserious 阅读(328) 评论(0) 推荐(0) 编辑
leetcode 720. Longest Word in Dictionary
摘要:Given a list of strings words representing an English Dictionary, find the longest word in words that can be built one character at a time by other wo 阅读全文
posted @ 2018-02-23 15:01 Beserious 阅读(135) 评论(0) 推荐(0) 编辑
leetcode 763. Partition Labels
摘要:A string S of lowercase letters is given. We want to partition this string into as many parts as possible so that each letter appears in at most one p 阅读全文
posted @ 2018-01-14 12:00 Beserious 阅读(211) 评论(0) 推荐(0) 编辑
leetcode 97. Interleaving String
摘要:Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. 第一个思路肯定可能就是递归了 class Solution { public: int mark = 0; void dfs(string& s 阅读全文
posted @ 2017-12-29 23:10 Beserious 阅读(190) 评论(0) 推荐(0) 编辑
leetcode 750. Number Of Corner Rectangles
摘要:Given a grid where each entry is only 0 or 1, find the number of corner rectangles. A corner rectangle is 4 distinct 1s on the grid that form an axis 阅读全文
posted @ 2017-12-17 13:41 Beserious 阅读(875) 评论(0) 推荐(0) 编辑

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