Category: c / c++
Given a vector, e.g. of integers, we want to apply a function to each element and transform to another vector/array. For example, we might want to return a new …
We sometimes need to print the string (or char array) with binary content in hexadecimal format, we then can use the following C function: void printCharInHexadecimal(const char* str, int …
Given a 32-bit integer, we want to find out the next highest power of 2. For example, the next power of two for 127 is 128. We can use …
Given a list of integers nums, return the length of the longest contiguous sublist where all its elements are distinct. Constraints n ≤ 100,000 where n is the length …
We know the IPv4 Address is 32-bit which consists of four integers from 0 to 255 inclusive. We can use a 32-bit integer to represent a valid IP address. …