One tricky question is How to know the allocated size of a void pointer without any kernel knowledge? Actually, some kernels store this information with a mapping, from the pointer and size of its heap memory. While, suppose you have know any how to figure them out, one simple solution is to customize the free() Read the full article…
The question is how to determine if two rectangles overlap each other. To simplify the question, we say the rectangles are on a 2 dimensional plane. The rectangles can be rotated.
This post is to discuss some implementation of radix sort, which varies from bucket sort. To simplify the case, we are going to sort an array of positive integers. At the end of this post, I will discuss how to extend it to other data.
Question Validate if a given string is numeric. Some examples: “0” => true ” 0.1 ” => true “abc” => false “1 a” => false “2e10” => true Note: It is intended for the problem statement to be ambiguous. You should gather all requirements up front before implementing one. This question is provided by LeetCode.
Question Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy one and sell one share of the stock multiple times). However, you may not engage Read the full article…
Question Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), design an algorithm to find the maximum profit. This question is provided by Read the full article…
Question Write a program to solve a Sudoku puzzle by filling the empty cells. Empty cells are indicated by the character ‘.’. You may assume that there will be only one unique solution. This question is provided by LeetCode.
Question Determine if a Sudoku is valid, according to: Sudoku Puzzles – The Rules. The Sudoku board could be partially filled, where empty cells are filled with the character ‘.’. This question is provided by LeetCode.
Question Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For example, Given: s1 = “aabcc”, s2 = “dbbca”, When s3 = “aadbbcbcac”, return true. When s3 = “aadbbbaccc”, return false. This question is provided by LeetCode.
Question Given a list, rotate the list to the right by k places, where k is non-negative. For example: Given 1->2->3->4->5->NULL and k = 2, return 4->5->1->2->3->NULL. This question is provided by LeetCode.