随笔分类 -  LeetCode

上一页 1 ··· 40 41 42 43 44 45 46 47 48 ··· 61 下一页
摘要: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 阅读(10121) 评论(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 阅读(13621) 评论(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 阅读(17830) 评论(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 阅读(14673) 评论(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 阅读(5895) 评论(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 阅读(7001) 评论(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 阅读(4249) 评论(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 阅读(4993) 评论(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 阅读(4899) 评论(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 阅读(5391) 评论(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 阅读(6778) 评论(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 阅读(6295) 评论(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 阅读(5103) 评论(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 阅读(3079) 评论(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 阅读(3826) 评论(0) 推荐(0) 编辑
摘要:Given a nested list of integers, implement an iterator to flatten it. Each element is either an integer, or a list -- whose elements may also be integ 阅读全文
posted @ 2016-04-06 12:41 Grandyang 阅读(21257) 评论(3) 推荐(0) 编辑
摘要:The Employee table holds all employees including their managers. Every employee has an Id, and there is also a column for the manager Id. Given the Em 阅读全文
posted @ 2016-04-05 11:21 Grandyang 阅读(3842) 评论(0) 推荐(1) 编辑
摘要:Write a SQL query to find all numbers that appear at least three times consecutively. For example, given the above Logs table, 1 is the only number th 阅读全文
posted @ 2016-04-05 10:51 Grandyang 阅读(6314) 评论(0) 推荐(0) 编辑
摘要:Write a SQL query to rank scores. If there is a tie between two scores, both should have the same ranking. Note that after a tie, the next ranking num 阅读全文
posted @ 2016-04-04 11:20 Grandyang 阅读(14105) 评论(17) 推荐(0) 编辑
摘要:Given a string, find the length of the longest substring T that contains at most k distinct characters. Example 1: Input: s = "eceba", k = 2 Output: 3 阅读全文
posted @ 2016-04-04 08:22 Grandyang 阅读(26757) 评论(7) 推荐(1) 编辑

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