This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
void printSS(string ques, string ans) { | |
if(ques.length() == 0) { // base case | |
cout << ans << endl; // printing ans string | |
return; | |
} | |
printSS(ques.substr(1), ans + ques[0]); //recursive call including first character in ans string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
string codes[] = {".;", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tu", "vwx", "yz"}; | |
void printKPC(string ques, string asf){ | |
if(ques.length() == 0) { //base case | |
cout << asf << endl; | |
return; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
void printStairPaths(int n, string psf){ | |
if(n == 0) { //base case | |
cout << psf << endl; //print output string psf(path so far) | |
return; | |
} | |
for(int jumps = 1; jumps <= 3; jumps++) { // loop for making all possible jumps |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
void printMazePaths(int sr, int sc, int dr, int dc, string psf){ | |
if(sr == dr && sc == dc) { // base case | |
cout << psf << endl; // output | |
return; | |
} | |
if(sr > dr || sc > dc) { // to prevent illegal moves |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
using namespace std; | |
void printMazePathsWithJumps(int sr, int sc, int dr, int dc, string psf) { | |
if(sr == dr && sc == dc) { //base case | |
cout << psf << endl; | |
return; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
void printPermutations(string str, string asf){ | |
if(str.length() == 0) { // base case | |
cout << asf << endl; | |
return; | |
} | |
for(int i = 0; i < str.length(); i++) { // loop for traversing the string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include<string> | |
using namespace std; | |
void printEncoding(string str, string asf){ | |
if(str.length() == 0) { // base case | |
cout << asf << endl; | |
return; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Description: | |
This problem is to improve your knowledge about basics of java and also to make you familiar with the data structure - Arrays. | |
In this problem we will start from the top left corner and traverse through the array with the constraint that whenever we encounter a cell containing a 1, we will take a 90° right turn, and will move straight while we encounter a 0. | |
Thats it about the problem, watch the video and have fun while learning... | |
Question Name: | |
Exit Point of a Matrix | |
Question Link: | |
https://www.pepcoding.com/resources/online-java-foundation/2d-arrays/exit-point-matrix-official/ojquestion |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Description: | |
In this problem we are required to rotate a matrix by 90 degrees, so for that we need to first transpose the matrix and then mirror it's row elements, basically swap its row elements like first with last and so on, watch the video for better understanding. | |
Question Name: | |
Rotate By 90 Degree | |
Question Link : | |
https://www.pepcoding.com/resources/online-java-foundation/2d-arrays/rotate-by-90-degree-official/ojquestion | |
Question Statement: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Description: | |
This one is a rather important question, brief intro is provided in question statement, take that as reference, but, we suggest you to watch the video for better understanding of the problem | |
Question Name: | |
Ring Rotate | |
Question Link: | |
https://www.pepcoding.com/resources/online-java-foundation/2d-arrays/ring-rotate-official/ojquestion | |
Question Statement: |
OlderNewer