Suzy Zhang

Home Archives About
2017-09-29
Algorithm

LintCode/Flip Bits

Problem Summary

Determine the number of bits to flip when converting integer n to integer m.

Read More

Share Comments
  • Bit Manipulation
  • LintCode
2017-09-28
Algorithm

LintCode/Binary Representation

Problem Summary

Given a decimal number that is passed in as a string, return the binary representation (also a string). If the fractional part of the number can not be represented accurately in binary with at most 32 characters, return ERROR.

Read More

Share Comments
  • Bit Manipulation
  • LintCode
2017-09-27
Algorithm

LintCode/Trailing Zeros

Problem Summary

Find the number of trailing zeros in N! (N factorial).

Read More

Share Comments
  • LintCode
  • Number Theory
2017-09-26
Algorithm

HackerRank/Dynamic Programming/Substring Diff

Problem Summary

Given two strings of length N (P and Q) and an integer S, find the maximum of L such that there exists a pair of indices(i,j) for which we have M(i,j,L) ≤ S.

M(i,j,L) refers to the size of the set {0 ≤ x < L | p[i+x] ≠ q[j+x]}.

Read More

Share Comments
  • Binary Search
  • DP
  • HackerRank
2017-09-25
Algorithm

LintCode/Search For A Range

Problem Summary

Given a sorted array of N integers, find the starting and ending position of a given target value.

Read More

Share Comments
  • Binary Search
  • LintCode
2017-09-25
Algorithm

LintCode/Wood Cut

Problem Summary

Given N pieces of wood with integer length L[i], cut them into equal to or more than K pieces with the same integer length. Find the maximum length of the small pieces.

Read More

Share Comments
  • Binary Search
  • LintCode
2017-09-20
Algorithm

LintCode/Find Peak Element

Problem Summary

A is an array with N integers which has the following features:

  1. The numbers in adjacent positions are different.
  2. A[0] < A[1] && A[N - 2] > A[N - 1].

We define a position P is a peak if: A[P] > A[P-1] && A[P] > A[P+1]

Find a peak element in this array.

Read More

Share Comments
  • Binary Search
  • LintCode
2017-09-19
Algorithm

HackerRank/Algorithm/Dynamic Programming/Angry Children 2

Problem Summary

Suppose there are K packets with (x1, x2, x3,….xk) candies in them, where xi denotes the number of candies in the ith packet, then we define unfairness as

Unfairness

Given N packets, find the minimum unfairness when you pick K out of N packets.

Read More

Share Comments
  • DP
  • HackerRank
2017-09-18
Algorithm

HackerRank/Algorithm/Dynamic Programming/The Maximum Subarray

Problem Summary

Given an array A with N integers, find the maximum sum of a

  1. Continguous subarray.
  2. Not necessarily contiguous subarray.

Empty subarrays or subsequences should not be considered.

Read More

Share Comments
  • DP
  • Greedy
  • HackerRank
2017-09-18
Algorithm

HackerRank/Algorithm/Dynamic Programming/Sam And Substrings

Problem Summary

Given a string of integers, whose first character is not zero, find the sum of all substrings.

Read More

Share Comments
  • DP
  • HackerRank
«Prev1…34567…9Next»

Categories

  • Algorithm85
  • Data Structure1

Tags

  • Array5
  • BFS3
  • Big Number1
  • Binary Search7
  • Binary Search Tree5
  • Binary tree1
  • Bit Manipulation3
  • Bucket Sort1
  • Codeforces1
  • Convex Hull1
  • Cycle Detection1
  • DFS4
  • DP23
  • DP on Trees1
  • Dijkstra1
  • Dinic1
  • Fast power1
  • Game Theory1
  • Geometry1
  • Graph Theory16
  • Greedy6
  • HackerRank18
  • Hash2
  • Heap1
  • Hungarian Alogrithm1
  • IDDFS2
  • Implementation2
  • LCA1
  • LeetCode12
  • Linked List3
  • LintCode31
  • MST1
  • Map Reduce1
  • Math1
  • Matrix1
  • Maximum Flow2
  • Merge Sort1
  • Minimum Cut2
  • Minimum length cycle1
  • Number Theory3
  • Partial order1
  • Prim1
  • Pruning2
  • SPFA1
  • Sort3
  • Stack1
  • String3
  • Strongly connected components1
  • Tarjan's algorithm1
  • Topological Sorting2
  • Tree2
  • Trie3
  • Two Pointers1
  • USACO25
  • Union-find1

Archives

  • April 20192
  • March 20192
  • November 201711
  • October 201724
  • September 201718
  • August 201719
  • July 201710

Recent Posts

  • LeetCode/Minimum Cost to Merge Stones
  • LeetCode/Lexicographical Numbers
  • LeetCode/Knight Dialer
  • LeetCode/Regions Cut by Slashes
  • LeetCode/Edit Distance
© 2020 Suzy Zhang
Powered by Hexo
Home Archives About