- 博客(21)
- 资源 (10)
- 收藏
- 关注
翻译 Contains Duplicate
Given an array of integers ,find if the array contains any duplicates.Your function should return true if any value appears at least twice in the array ,and it should return false if every element is ...
2018-02-22 17:19:52 85
转载 Rotate Array
Rotate an array of n elements to the right by k stepsfor example with n=7 and k=3,the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4]Try to come up as many solutions as you can,there are at least...
2018-02-22 17:10:46 107
翻译 Majority Element
Given an array of size n,find the majority element .The majority element is the element that appears that appears more than [n/2] times.You may assume that the array is non-empty and the majority elem...
2018-02-22 16:55:52 100
翻译 Candy
There are N children standing in a line.Each child is assigned a rating value.You are giving candies to these children subjuected to the following requirements·Each child must have at least one candy....
2018-02-22 16:45:02 153
翻译 Gas Station
There are N gas stations along a circular route, where the amount of gas at station i is gas[i],You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to itsnex...
2018-02-22 16:21:11 150
翻译 Set Matrix Zeroes
给定 mxn阶矩阵,如果一个节点为0,则设置其整行和整列为0code example 1:o(m+n)复杂度 public static void setZeros_1(int [][] matrix) { int m = matrix.Length; int n = matrix[0].Length; b...
2018-02-22 15:56:27 114
翻译 Climbing Stairs
You are climbing a stair case. It takes n steps to reach to the topEach time you can either climb 1 or 2 steps. In how many distingct ways can you climb to the tio?分析设f(n)表示爬n阶楼梯的不同方法数,为了爬到第n阶楼梯,有两个选择...
2018-02-22 15:24:38 218
翻译 PlusOne
Given a number represented as an array of digits,plus one to the number.code example: public static int[] plusOne(int[] digits) { return add(digits, 1); } public...
2018-02-22 15:02:03 130
转载 Rotate Image
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?分析首先想到,纯模拟,从外到内一圈一圈的转,但这个方法太慢。如下图,首先沿着副对角线翻转一次,然后沿着水平中线翻转一次。Figure...
2018-02-22 14:47:38 133
转载 ValideSudoku
Dtermine if a Sudoku is valid,according to :Sudoku Puzzles - The Rules http://sudoku.com.au/TheRules.aspx The Sudoku board could be partially filled,where empty cells are filled with the character '.'...
2018-02-22 14:30:06 139
转载 Trapping Rain Water
Given n non-negative integers representing an elevation map where the width of eahc bar is 1,compute how much water it is able to trap after raining For example,Given [0,1,0,2,1,0,1,3,2,1,2,1] ,return...
2018-02-22 14:26:13 165
转载 nextPermutation
Implement next permutation,which rearanges numbers into the lexicographically next greater permutation of numbers.if such arrangement is not possible ,it must rearrange it as the lowest possible order...
2018-02-12 16:31:08 223
翻译 MoveZero
Given an array nums write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. /// <summary> /// Given an array nums write a functi...
2018-02-12 15:22:03 393
翻译 Remove Element
Given an array and a value ,remove all instances of that value in place and return the new lengthcode Example: /// <summary> /// Remove Element from an array /// </sum...
2018-02-12 15:13:46 119
翻译 fourSum
given an array of n integers ,are there elements a,b,c,and d such that a+b+c+d=target?Find all unique quadruplets in the array which gives the sum of targetnote:Element in a quadruplet must be in non-...
2018-02-12 15:03:18 335
翻译 threeSumClosed
given an array s of n integers. find three integers in s such that the sum is closed to given a number,target . Return the sum of the three integers. You may assume that each input would have exactly...
2018-02-12 14:38:27 139
转载 3sum
given an array s of integers n , are there elements a,b,c in s such that a+b+c=0? find all unique triplets in the array which gives the sum of zero.code example : /// <summary> /// giv...
2018-02-12 11:08:10 105
原创 twoSum
given an array of Integers ,find two numbers such that they add up to a specific target number.The function twoNum should return indices of the two numbers such that they add up to the targer, where i...
2018-02-11 16:29:20 112
翻译 longest consencutive sequence
gaven an unsort array of integers, find the length of longest consencutive element sequece note: you algorithm should run in o(N) complexity.code example 1 /// <summary> /// given an ...
2018-02-11 15:52:07 145
翻译 remove duplicates from sort Array [2]
given sort arrays ,Follow up remove duplicates what if duplicates are allowed most at twicecode example 1 /// <summary> /// remove duplicates from sort arrays and duplicates are a...
2018-02-11 15:25:19 100
翻译 Remove Duplicates from Sorted Array
Given a sorted array,remove the duplicates in place such that each element apperence only once and return the new length.Do not allocate extra space for another array,you must do this in place with co...
2018-02-11 15:03:49 94
mysql-for-visualstudio-1.2
2018-05-22
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人