随笔分类 -  刷题

LeetCode、PAT的刷题笔记
摘要:Kth Largest Element in an Array Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not th 阅读全文
posted @ 2020-07-18 15:08 十三w~w 阅读(100) 评论(0) 推荐(0)
摘要:House Robber II You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at t 阅读全文
posted @ 2020-07-17 21:32 十三w~w 阅读(124) 评论(0) 推荐(0)
摘要:Add and Search Word - Data structure design Design a data structure that supports the following two operations: void addWord(word) bool search(word) s 阅读全文
posted @ 2020-07-16 16:26 十三w~w 阅读(92) 评论(0) 推荐(0)
摘要:Course Schedule II 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 co 阅读全文
posted @ 2020-07-16 15:40 十三w~w 阅读(126) 评论(0) 推荐(0)
摘要:Minimum Size Subarray Sum Given an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarray of which th 阅读全文
posted @ 2020-07-16 15:24 十三w~w 阅读(136) 评论(0) 推荐(0)
摘要:Implement Trie (Prefix Tree) Implement a trie with insert, search, and startsWith methods. Example: Trie trie = new Trie(); trie.insert("apple"); trie 阅读全文
posted @ 2020-07-16 14:53 十三w~w 阅读(103) 评论(0) 推荐(0)
摘要:Count Primes Count the number of prime numbers less than a non-negative number, *n*. Example: Input: 10 Output: 4 Explanation: There are 4 prime numbe 阅读全文
posted @ 2020-07-15 10:10 十三w~w 阅读(112) 评论(0) 推荐(0)
摘要:Isomorphic Strings Given two strings *s* and *t*, determine if they are isomorphic. Two strings are isomorphic if the characters in *s* can be replace 阅读全文
posted @ 2020-07-15 09:38 十三w~w 阅读(97) 评论(0) 推荐(0)
摘要:Course Schedule There are a total of numCourses courses you have to take, labeled from 0 to numCourses-1. Some courses may have prerequisites, for exa 阅读全文
posted @ 2020-07-15 09:22 十三w~w 阅读(139) 评论(0) 推荐(0)
摘要:Remove Linked List Elements Remove all elements from a linked list of integers that have value *val*. Example: Input: 1->2->6->3->4->5->6, val = 6 Out 阅读全文
posted @ 2020-07-15 08:45 十三w~w 阅读(88) 评论(0) 推荐(0)
摘要:Happy Number Write an algorithm to determine if a number n is "happy". A happy number is a number defined by the following process: Starting with any 阅读全文
posted @ 2020-07-14 22:11 十三w~w 阅读(125) 评论(0) 推荐(0)
摘要:Bitwise AND of Numbers Range Given a range [m, n] where 0 ⇐ m ⇐ n ⇐ 2147483647, return the bitwise AND of all numbers in this range, inclusive. Exampl 阅读全文
posted @ 2020-07-14 21:34 十三w~w 阅读(108) 评论(0) 推荐(0)
摘要:Number of Islands 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 阅读全文
posted @ 2020-07-14 18:45 十三w~w 阅读(111) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-07-14 18:11 十三w~w 阅读(70) 评论(0) 推荐(0)
摘要: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 constrain 阅读全文
posted @ 2020-07-14 16:55 十三w~w 阅读(126) 评论(0) 推荐(0)
摘要:Number of 1 Bits Write a function that takes an unsigned integer and return the number of '1' bits it has (also known as the Hamming weight). Example 阅读全文
posted @ 2020-07-14 16:27 十三w~w 阅读(102) 评论(0) 推荐(0)
摘要:Reverse Bits Reverse bits of a given 32 bits unsigned integer. Example 1: Input: 00000010100101000001111010011100 Output: 0011100101111000001010010100 阅读全文
posted @ 2020-07-13 11:03 十三w~w 阅读(116) 评论(0) 推荐(0)
摘要:Best Time to Buy and Sell Stock IV 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 fin 阅读全文
posted @ 2020-07-13 10:47 十三w~w 阅读(135) 评论(0) 推荐(0)
摘要:Best Time to Buy and Sell Stock III Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to fin 阅读全文
posted @ 2020-07-13 10:41 十三w~w 阅读(109) 评论(0) 推荐(0)
摘要:Best Time to Buy and Sell Stock II Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find 阅读全文
posted @ 2020-07-13 10:34 十三w~w 阅读(106) 评论(0) 推荐(0)