leetcode 208. Implement Trie (Prefix Tree) 设计前缀树 ---------- java
摘要:Implement a trie with insert, search, and startsWith methods. Note:You may assume that all inputs are consist of lowercase letters a-z. 设计一个前缀树,包括inse
阅读全文
leetcode 207. Course Schedule 课程计划 ---------- java
摘要:There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have prerequisites, for example to take course 0 you have t
阅读全文
leetcode 205. Isomorphic Strings 判断两个字符串能否互相转换 ---------- java
摘要: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
阅读全文
leetcode 204. Count Primes 找出素数的个数 ---------- java
摘要:Description: Count the number of prime numbers less than a non-negative number, n. 找出小于n的素数个数。 1、用最淳朴的算法果然超时了。 2、埃拉托斯特尼筛法Sieve of Eratosthenes 我们从2开始遍
阅读全文
leetcode 203. Remove Linked List Elements 删除链表中的某个值 ---------- java
摘要:Remove all elements from a linked list of integers that have value val. ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 --
阅读全文
leetcode 201. Bitwise AND of Numbers Range 求范围中,每一位都是1的数 ---------- java
摘要:Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive. For example, given the range [5,
阅读全文
leetcode 200. Number of Islands 求岛的数量 ---------- java
摘要:Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacen
阅读全文
leetcode 199. Binary Tree Right Side View 求所能看到的叶子节点 ---------- java
摘要: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. For exa
阅读全文
leetcode 198. House Robber 求抢劫的最大金额 ---------- java
摘要: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
阅读全文
leetcode 191. Number of 1 Bits 求二进制1的个数 ---------- java
摘要:Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight). For example, the 32-bit
阅读全文
leetcode 190. Reverse Bits (int)数字旋转 ---------- java
摘要:Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), retur
阅读全文
leetcode 189. Rotate Array 数组旋转 ---------- java
摘要:Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4]. 就是把
阅读全文
leetcode 187. Repeated DNA Sequences 求重复的DNA串 ---------- java
摘要:All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is sometimes useful to
阅读全文
leetcode 186. Reverse Words in a String II 旋转字符数组 ---------- java
摘要:Given an input string, reverse the string word by word. A word is defined as a sequence of non-space characters. The input string does not contain lea
阅读全文
leetcode 179. Largest Number 求最大组合数 ---------- java
摘要:Given a list of non negative integers, arrange them such that they form the largest number. For example, given [3, 30, 34, 5, 9], the largest formed n
阅读全文
✡ leetcode 174. Dungeon Game 地牢游戏 --------- java
摘要:The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of M x N rooms laid out in a
阅读全文
✡ leetcode 173. Binary Search Tree Iterator 设计迭代器(搜索树)--------- java
摘要:Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST. Calling next() will return the n
阅读全文
✡ leetcode 172. Factorial Trailing Zeroes 阶乘中的结尾0个数--------- java
摘要:Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic time complexity. 主要是思考清楚计算过程: 将一个数进行因式分解,
阅读全文
✡ leetcode 171. Excel Sheet Column Number 字母转换为数字 --------- java
摘要:Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, return its corresponding column number. For example: 很简
阅读全文
|
|
|