Sudhir sharma has Published 1206 Articles

Print * in place of characters for reading passwords in C

sudhir sharma

sudhir sharma

Updated on 03-Feb-2020 10:20:11

511 Views

In this problem, we are given a string password. Our task is to print * in place of characters of the password.Let’s take an example to understand the problem, Input: password Output ********To solve this problem, we will traverse the password we have entered and print * in place of ... Read More

Print Kth least significant bit of a number in C++

sudhir sharma

sudhir sharma

Updated on 03-Feb-2020 10:17:46

341 Views

In this problem, we are given two numbers n and k. Our task is to print the kth least significant bit of the number n.Let’s take an example to understand the problemInput: n = 12 , k = 3 Output 1 Explanation: Let’s see the binary representation of n: 12 ... Read More

Print 1 2 3 infinitely using threads in C

sudhir sharma

sudhir sharma

Updated on 03-Feb-2020 10:15:24

342 Views

Here, we have to print 1 2 3 sequences repeatedly infinite number of times using threads in the c programming language.Let’s see the sample output that we want from our code, 1 2 3 1 2 3 1 2 3 1 2 3For this, we will have to use three ... Read More

Print 2-D co-ordinate points in ascending order followed by their frequencies in C++

sudhir sharma

sudhir sharma

Updated on 03-Feb-2020 10:09:17

129 Views

In this problem, we are given 2 arrays x[] , y[] such that (x, y) gives a cordinate of a point in 2D plane. Our task is to print all points along with their frequencies of occurence.Let’s take an example to understand the problemInput: x[]={0, 1, 1, 0, 0} ; ... Read More

Print 2D matrix in different lines and without curly braces in C/C++

sudhir sharma

sudhir sharma

Updated on 03-Feb-2020 09:58:11

198 Views

Here, we will see the code that will print a 2D matrix in c/c++ programming language without using curly braces.Curly braces are separators in a programming language that are used to define separate code blocks in the program. Without curly braces defining scopes is difficult in c/c++.Let’s see the basic ... Read More

Print a case where the given sorting algorithm fails in C++

sudhir sharma

sudhir sharma

Updated on 27-Jan-2020 06:50:32

50 Views

In this problem, we are given a sorting algorithm and a number n. Our task is to print an array of n elements that could not be sorted by the algorithm. i.e the algorithm will fail.Algorithmloop i from 1 to n-1    loop j from i to n-1    if ... Read More

Print a closest string that does not contain adjacent duplicates in C++

sudhir sharma

sudhir sharma

Updated on 27-Jan-2020 06:47:12

104 Views

In this problem, we are given a string. Our task is to print a string that is closest to the current string and does not contain any adjacent duplicate characters.Let’s take an example to understand the problemInput: string = “good” Output: goadIn this example, we found that the elements at ... Read More

Print a given matrix in counter-clockwise spiral form in C++

sudhir sharma

sudhir sharma

Updated on 27-Jan-2020 06:42:59

654 Views

In this problem, we are given a 2-dimensional matrix. And our task is to print the elements of the matrix in a counter-clockwise spiral from.Counterclockwise Spiral Form − It is a spiral traversal which starts from top-left and the goes in the counter-clockwise direction to first bottom-right-up-left.The counter-clockwise traversal will ... Read More

Print a given matrix in reverse spiral form in C++

sudhir sharma

sudhir sharma

Updated on 27-Jan-2020 06:38:54

346 Views

In this problem, we are given a 2-dimensional matrix. Our task is to print all the elements of the matrix in reverse spiral form.Let’s take an example to understand the problemInput:    12 23 54 67    76 90 01 51    43 18 49 5    31 91 75 ... Read More

Print a given matrix in zigzag form in C++

sudhir sharma

sudhir sharma

Updated on 27-Jan-2020 06:36:07

541 Views

In this problem, we are given a 2-dimensional matrix. Our task is to print the zigzag form of the matrix.Let’s take an example to understand the problemInput:    12 99 43    10 82 50    15 75 5 Output: 12 99 43 50 82 10 15 75 5To solve ... Read More

Advertisements