Interview Problems
Some of most asked C++ problems that are asked by interviewers in Round 1 of Coding.
- Palindrome Number (without string conversion)To solve this problem, we can use a simple algorithm that involves reversing the digits of the given number and then comparing the reversed number with the original number. If they are the same, the number is a palindrome; otherwise, it’s not.
- Check Number is Palindrome Number or not?A “Palindrome Number” is a number that remains the same when its digits are reversed….
Table of Contents
Replace the last word of a string with number
C++ Code for Replace the last word of a string with number Replace the first…
sort a huge array of numbers with a max number.
If you have a huge array of numbers with a maximum value (say 101), you…
Implement square root function.
Square root using binary search: Square root using Newton-Raphson method:
Implement a priority queue using a heap
A priority queue is a data structure that maintains a set of elements, each associated…
Graph Topological sort
Topological sorting is an ordering of the vertices of a directed graph such that for…
Implement a thread-safe queue
A thread-safe queue is a data structure designed to be used concurrently by multiple threads…
Implement a breadth-first search (BFS) on a graph.
Breadth-First Search (BFS) is graph traversal algorithm that explores a graph level by level, visiting…
Implement depth-first search (DFS) on a graph.
Depth-First Search (DFS) is a graph traversal algorithm that explores as far as possible along…
Implement Circular queue.
A circular queue is a data structure that uses a fixed-size array or a linked…
Producer Consumer problem
The producer-consumer problem is a classic synchronization problem in computer science and concurrent programming. It…