Category: c / c++
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. …
In the following C function, we can launch a command and capture its output and store in a 2 dimensional char array. The function returns the number of the …