Category: c / c++
A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down). Find all strobogrammatic numbers that are of length = n. Example: …
Given a root of an N-ary tree, you need to compute the length of the diameter of the tree. The diameter of an N-ary tree is the length of …
Implement pow(x, n), which calculates x raised to the power n (xn). Example 1: Input: 2.00000, 10 Output: 1024.00000 Example 2: Input: 2.10000, 3 Output: 9.26100 Example 3: Input: …
Given an input string, reverse the string word by word. Example 1: Input: “the sky is blue” Output: “blue is sky the” Example 2: Input: ” hello world! ” …
Given all the nodes of an N-ary tree as an array Node tree where each node has a unique value. Find and return the root of the N-ary tree. …