Tag: C++ coding exercise
Write an algorithm to determine if a number is “happy”. A happy number is a number defined by the following process: Starting with any positive integer, replace the number …
A Singly Linked List is a one-direction List that uses a pointer to connect between Nodes. To reverse a linked list, you need to re-connect the directions, for example: …
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. This is an data-structure problem that you would need to come up with …
Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the …
Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it …