CNoodle
  • Home
  • Archives
  • Tags
  • About

[LeetCode] 35. Search Insert Position

Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You must write an algori
2019-10-30
#leetcode #java #javascript #binary search

[LeetCode] 274. H-Index

Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher’s h-index. According to the definition of h-index on Wikipedia: “A sci
2019-10-29
#leetcode #java #javascript #counting sort #binary search

[LeetCode] 283. Move Zeroes

Given an integer array nums, move all 0’s to the end of it while maintaining the relative order of the non-zero elements. Note that you must do this in-place without making a copy of the array. Exampl
2019-10-23
#leetcode #array #two pointer #java #javascript

[LeetCode] 287. Find the Duplicate Number

Given an array of integers nums containing n + 1 integers where each integer is in the range [1, n] inclusive. There is only one repeated number in nums, return this repeated number. You must solve th
2019-10-23
#leetcode #array #two pointer #java #javascript #binary search

[LeetCode] 187. Repeated DNA Sequences

The DNA sequence is composed of a series of nucleotides abbreviated as ‘A’, ‘C’, ‘G’, and ‘T’. For example, “ACGAATTCCG” is a DNA sequence. When studying DNA, it is useful to identify repeated sequenc
2019-10-17
#leetcode #hashmap #java #javascript #string

[LeetCode] 75. Sort Colors

Given an array nums with n objects colored red, white, or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order red, white, and blue. We will use the in
2019-10-17
#leetcode #array #two pointer #java #javascript #quick sort

[LeetCode] 191. Number of 1 Bits

Write a function that takes an unsigned integer and returns the number of ‘1’ bits it has (also known as the Hamming weight). Note:Note that in some languages, such as Java, there is no unsigned integ
2019-10-15
#leetcode #java #javascript #bit manipulation

[LeetCode] 206. Reverse Linked List

Given the head of a singly linked list, reverse the list, and return the reversed list. Example 1:Input: head = [1,2,3,4,5]Output: [5,4,3,2,1] Example 2:Input: head = [1,2]Output: [2,1] Exam
2019-10-14
#leetcode #java #recursion #linked list

[LeetCode] 202. Happy Number

Write an algorithm to determine if a number n is happy. A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of
2019-10-14
#leetcode #hashmap #java #javascript #math

[LeetCode] 2. Add Two Numbers

You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return
2019-10-13
#leetcode #java #javascript #linked list
1…41424344

Search

Hexo Fluid