Practice (Intermediate)

back to index  |  new

Show that $2013^2 +2013^2\times 2014^2 + 2014^2$ is a perfect sqare.


Compute $\sqrt[32]{259\times 23\times 11 +9}$.


Let $f(x)$ be a second degree function satisfying $f(-2)=0$ and $2x \lt f(x) \le\frac{x^2+4}{2}$. Find the value of $f(10)$.


Let $a$, $b$, $c$, $x$, $y$, and $z$ be positive numbers. Show that $$\sqrt{a^2+x^2} + \sqrt{b^2 + y^2}+\sqrt{c^2+z^2} \ge \sqrt{(a+b+c)^2 + (x+y+z)^2}$$


Let positive numbers $a$, $b$ and $c$ satisfy $a+b+c=8$. Find the minimal value of $\sqrt{a^2+1}+\sqrt{b^2+4}+\sqrt{c^2+9}$.


Solve $x^{x^{88}} - 88=0$.


Given a pointer pointing to the header of a linked list, how to detect whether the linked list has a loop?

An additional question: how can math knowledge help here?


Show that there exists a perfect sqaure whose leading $2024$ digits are all $1$.


For any given integer $N$, show that there exists a perfect square whose leading digits match $N$. For example, if $N=2024$, there must exist a perfect square whose leading four digits are $2024$.


Given an string as input, find the length of the longest palindrome it contains. A palindrome is a word which stays the same if reading backwards. Examples include madam, Hannah. 


Determine whether a given integer can be expressed as the sum of two perfect squares.


(Coin Change Problem) Given a set of $N$ possible denominations of coins, find the number of different combinations to pay for a desired sum.


You are given an integer array height of length $n$. There are $n$ vertical lines drawn such that the two endpoints of the $i$th line are $(i, 0)$ and ($i$, height[$i$]). Find two lines that together with the $x$-axis form a container, such that the container contains the most water. Return the maximum amount of water a container can store.

Input: height = $[1,8,6,2,5,4,8,3,7]$

Output: $49$

Explanation: The above vertical lines are represented by array $[1,8,6,2,5,4,8,3,7]$. In this case, the max area of water (blue section) the container can contain is $49$.


Design an algorithm that finds the number of ways in which you can traverse $N$ meters by doing jumps of $1$, $2$, $3$, $4$, or $5$ meter lengths.


On a $M\times N$ board, some cells are occupied. Find the size of the largest square of unoccupied cells. 


Given two strings s and t, return true if they are equal when both are typed into empty text editors. '#' means a backspace character. (Note that after backspacing an empty text, the text will continue empty.)

Example 1:

Input: s = "ab#c", t = "ad#c"

Output: true

Explanation: Both s and t become "ac".

Example 2:

Input: s = "ab##", t = "c#d#"

Output: true

Explanation: Both s and t become "".

Example 3:

Input: s = "a#c", t = "b"

Output: false

Explanation: s becomes "c" while t becomes "b".