代码改变世界

[LeetCode] 88. Merge Sorted Array_Easy tag: Two Pointers

2018-08-12 05:21 by Johnson_强生仔仔, 197 阅读, 0 推荐, 收藏, 编辑
摘要:Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note: The number of elements initialized in nums1 and num 阅读全文

[LeetCode] 258. Add Digits_Easy tag: Math

2018-08-11 11:59 by Johnson_强生仔仔, 157 阅读, 0 推荐, 收藏, 编辑
摘要:Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. Example: Follow up:Could you do it without any lo 阅读全文

[LeetCode] 193. Valid Phone Numbers_Easy tag: Bash

2018-08-11 05:32 by Johnson_强生仔仔, 220 阅读, 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 阅读全文

[LeetCode] 38. Count and Say_Easy

2018-08-11 05:13 by Johnson_强生仔仔, 176 阅读, 0 推荐, 收藏, 编辑
摘要:The count-and-say sequence is the sequence of integers with the first five terms as following: 1 is read off as "one 1" or 11.11 is read off as "two 1 阅读全文

[LeetCode] 561. Array Partition I_Easy tag: Sort

2018-08-11 04:39 by Johnson_强生仔仔, 211 阅读, 0 推荐, 收藏, 编辑
摘要:Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of 阅读全文

[LeetCode] 595. Big Countries_Easy tag: SQL

2018-08-11 04:28 by Johnson_强生仔仔, 225 阅读, 0 推荐, 收藏, 编辑
摘要:There is a table World A country is big if it has an area of bigger than 3 million square km or a population of more than 25 million. Write a SQL solu 阅读全文

[LeetCode] 195. Tenth Line_Easy tag: Bash

2018-08-11 04:21 by Johnson_强生仔仔, 210 阅读, 0 推荐, 收藏, 编辑
摘要:Given a text file file.txt, print just the 10th line of the file. Example: Assume that file.txt has the following content: Line 1 Line 2 Line 3 Line 4 阅读全文

[LeetCode] 237. Delete Node in a Linked List_Easy tag: Linked List

2018-08-11 00:44 by Johnson_强生仔仔, 218 阅读, 0 推荐, 收藏, 编辑
摘要:Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Given linked list -- head = [4,5,1,9], wh 阅读全文

[LeetCode] 458. Poor Pigs_Easy tag: Math

2018-08-10 23:59 by Johnson_强生仔仔, 143 阅读, 0 推荐, 收藏, 编辑
摘要:There are 1000 buckets, one and only one of them contains poison, the rest are filled with water. They all look the same. If a pig drinks that poison 阅读全文

[LeetCode] 292. Nim Game_Easy tag: Math

2018-08-10 23:19 by Johnson_强生仔仔, 213 阅读, 0 推荐, 收藏, 编辑
摘要:You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 ston 阅读全文
上一页 1 ··· 26 27 28 29 30 31 32 33 34 ··· 39 下一页