Category: c / c++
In a binary tree, a lonely node is a node that is the only child of its parent node. The root of the tree is not lonely because it …
We have a list of points on the plane. Find the K closest points to the origin (0, 0). (Here, the distance between two points on a plane is …
Given two strings s1 and s2, write an algorithm to determine if s1 is one permutation of s2. For example: s1 = “abc”, s2 = “bca” output: true s1 …
In C++, there is no inbuilt split method for string. It is very useful to split a string into a vector of string. We can use the following string …
Given an array of integers nums and an integer k. A subarray is called nice if there are k odd numbers on it. Return the number of nice sub-arrays. …