随笔分类 -  LeetCode

上一页 1 ··· 40 41 42 43 44 45 46 47 48 ··· 61 下一页
摘要:Given two arrays, write a function to compute their intersection. Example 1: Input: nums1 = [1,2,2,1], nums2 = [2,2] Output: [2,2] Example 2: Input: n 阅读全文
posted @ 2016-05-27 06:21 Grandyang 阅读(18553) 评论(10) 推荐(1)
摘要:Given two arrays, write a function to compute their intersection. Example 1: Input: nums1 = [1,2,2,1], nums2 = [2,2] Output: [2] Example 2: Input: num 阅读全文
posted @ 2016-05-18 23:33 Grandyang 阅读(26063) 评论(5) 推荐(1)
摘要:Design a Tic-tac-toe game that is played between two players on a n x n grid. You may assume the following rules: A move is guaranteed to be valid and 阅读全文
posted @ 2016-05-06 21:07 Grandyang 阅读(21903) 评论(5) 推荐(0)
摘要:Given a non-empty array of integers, return the k most frequent elements. Example 1: Example 2: Input: nums = [1], k = 1 Output: [1] Example 2: Note: 阅读全文
posted @ 2016-05-03 10:42 Grandyang 阅读(29605) 评论(8) 推荐(0)
摘要:Given a stream of integers and a window size, calculate the moving average of all integers in the sliding window. Example: MovingAverage m = new Movin 阅读全文
posted @ 2016-05-01 05:35 Grandyang 阅读(15590) 评论(0) 推荐(0)
摘要:Write a function that takes a string as input and reverse only the vowels of a string. Example 1:Given s = "hello", return "holle". Example 2:Given s 阅读全文
posted @ 2016-04-24 12:07 Grandyang 阅读(10227) 评论(2) 推荐(0)
摘要:Write a function that reverses a string. The input string is given as an array of characters char[]. Do not allocate extra space for another array, yo 阅读全文
posted @ 2016-04-22 12:38 Grandyang 阅读(13708) 评论(6) 推荐(0)
摘要: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 @ 2016-04-20 11:35 Grandyang 阅读(18162) 评论(16) 推荐(2)
摘要:Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example 1: Example 2: Input: 5 Output: false Example 2: Follo 阅读全文
posted @ 2016-04-18 11:31 Grandyang 阅读(14851) 评论(5) 推荐(0)
摘要:Given a text file file.txt that contains list of phone numbers (one per line), write a one liner bash script to print all valid phone numbers. You may 阅读全文
posted @ 2016-04-13 23:43 Grandyang 阅读(5949) 评论(2) 推荐(0)
摘要:Write a bash script to calculate the frequency of each word in a text file words.txt. For simplicity sake, you may assume: words.txt contains only low 阅读全文
posted @ 2016-04-13 11:33 Grandyang 阅读(7104) 评论(1) 推荐(1)
摘要:Given a text file file.txt, transpose its content. You may assume that each row has the same number of columns and each field is separated by the ' '  阅读全文
posted @ 2016-04-12 12:26 Grandyang 阅读(4297) 评论(0) 推荐(0)
摘要:How would you print just the 10th line of a file? For example, assume that file.txt has the following content: Your script should output the tenth lin 阅读全文
posted @ 2016-04-11 06:12 Grandyang 阅读(5063) 评论(0) 推荐(0)
摘要:The Trips table holds all taxi trips. Each trip has a unique Id, while Client_Id and Driver_Id are both foreign keys to the Users_Id at the Users tabl 阅读全文
posted @ 2016-04-10 12:47 Grandyang 阅读(4936) 评论(6) 推荐(0)
摘要:Given a Weather table, write a SQL query to find all dates' Ids with higher temperature compared to its previous (yesterday's) dates. For example, ret 阅读全文
posted @ 2016-04-09 13:08 Grandyang 阅读(5529) 评论(1) 推荐(0)
摘要:Write a SQL query to delete all duplicate email entries in a table named Person, keeping only unique emails based on its smallest Id. For example, aft 阅读全文
posted @ 2016-04-09 11:35 Grandyang 阅读(6859) 评论(0) 推荐(0)
摘要:The Employee table holds all employees. Every employee has an Id, and there is also a column for the department Id. The Department table holds all dep 阅读全文
posted @ 2016-04-08 13:21 Grandyang 阅读(6363) 评论(1) 推荐(1)
摘要:The Employee table holds all employees. Every employee has an Id, a salary, and there is also a column for the department Id. The Department table hol 阅读全文
posted @ 2016-04-08 07:24 Grandyang 阅读(5156) 评论(1) 推荐(0)
摘要:Suppose that a website contains two tables, the Customers table and the Orders table. Write a SQL query to find all customers who never order anything 阅读全文
posted @ 2016-04-07 06:41 Grandyang 阅读(3128) 评论(1) 推荐(0)
摘要:Write a SQL query to find all duplicate emails in a table named Person. For example, your query should return the following for the above table: Note: 阅读全文
posted @ 2016-04-07 06:09 Grandyang 阅读(3875) 评论(0) 推荐(0)

上一页 1 ··· 40 41 42 43 44 45 46 47 48 ··· 61 下一页
Fork me on GitHub