随笔分类 -  array and hashmap

摘要:An abbreviation of a word follows the form <first letter><number><last letter>. Below are some examples of word abbreviations: Assume you have a dicti 阅读全文
posted @ 2016-12-05 11:40 微微程序媛 阅读(269) 评论(0) 推荐(0) 编辑
摘要:Given a non-empty string s and an abbreviation abbr, return whether the string matches with the given abbreviation. A string such as "word" contains o 阅读全文
posted @ 2016-12-05 10:57 微微程序媛 阅读(181) 评论(0) 推荐(0) 编辑
摘要:Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules. The Sudoku board could be partially filled, where empty cells are filled wit 阅读全文
posted @ 2016-12-05 08:06 微微程序媛 阅读(104) 评论(0) 推荐(0) 编辑
摘要:Given an array of integers, find out whether there are two distinct indices i and j in the array such that the difference between nums[i] and nums[j]  阅读全文
posted @ 2016-12-05 07:18 微微程序媛 阅读(134) 评论(0) 推荐(0) 编辑
摘要:Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two 阅读全文
posted @ 2016-12-05 05:10 微微程序媛 阅读(194) 评论(0) 推荐(0) 编辑
摘要:Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. 阅读全文
posted @ 2016-12-03 05:29 微微程序媛 阅读(209) 评论(0) 推荐(0) 编辑
摘要:Given an unsorted integer array, find the first missing positive integer. For example,Given [1,2,0] return 3,and [3,4,-1,1] return 2. Your algorithm s 阅读全文
posted @ 2016-12-03 04:31 微微程序媛 阅读(176) 评论(0) 推荐(0) 编辑
摘要:1. Two Sum Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input wo 阅读全文
posted @ 2016-12-02 04:02 微微程序媛 阅读(323) 评论(0) 推荐(0) 编辑
摘要:136. Single Number Given an array of integers, every element appears twice except for one. Find that single one. Bit: a ^ a = 0; 137. Single Number II 阅读全文
posted @ 2016-12-01 12:14 微微程序媛 阅读(157) 评论(0) 推荐(0) 编辑
摘要:Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. For example,Given n = 3, You should return the followi 阅读全文
posted @ 2016-12-01 10:11 微微程序媛 阅读(97) 评论(0) 推荐(0) 编辑
摘要:Given two numbers represented as strings, return multiplication of the numbers as a string. Note: The numbers can be arbitrarily large and are non-neg 阅读全文
posted @ 2016-11-28 08:21 微微程序媛 阅读(125) 评论(0) 推荐(0) 编辑
摘要:Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. For example,Given the following matrix: You s 阅读全文
posted @ 2016-11-27 14:08 微微程序媛 阅读(164) 评论(0) 推荐(0) 编辑
摘要:Follow up for "Remove Duplicates":What if duplicates are allowed at most twice? For example,Given sorted array nums = [1,1,1,2,2,3], Your function sho 阅读全文
posted @ 2016-11-27 13:38 微微程序媛 阅读(93) 评论(0) 推荐(0) 编辑
摘要:Given an array of integers A and let n to be its length. Assume Bk to be an array obtained by rotating the array A k positions clock-wise, we define a 阅读全文
posted @ 2016-11-27 11:49 微微程序媛 阅读(262) 评论(0) 推荐(0) 编辑
摘要:You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Follow up:Could you do this in-place? The idea was 阅读全文
posted @ 2016-11-27 11:11 微微程序媛 阅读(101) 评论(0) 推荐(0) 编辑
摘要:Given an absolute path for a file (Unix-style), simplify it. For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c" click to show co 阅读全文
posted @ 2016-11-27 06:57 微微程序媛 阅读(243) 评论(0) 推荐(0) 编辑
摘要:Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place. click to show follow up. Follow up: Did you use extra sp 阅读全文
posted @ 2016-11-26 14:40 微微程序媛 阅读(161) 评论(0) 推荐(0) 编辑
摘要:Given a string, sort it in decreasing order based on the frequency of characters. Example 1: Example 2: Example 3: 阅读全文
posted @ 2016-11-26 02:09 微微程序媛 阅读(195) 评论(0) 推荐(0) 编辑
摘要:Given n points in the plane that are all pairwise distinct, a "boomerang" is a tuple of points (i, j, k) such that the distance between i and j equals 阅读全文
posted @ 2016-11-25 12:42 微微程序媛 阅读(248) 评论(0) 推荐(0) 编辑
摘要:Given a sequence of words, check whether it forms a valid word square. A sequence of words forms a valid word square if the kth row and column read th 阅读全文
posted @ 2016-11-24 10:33 微微程序媛 阅读(189) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示