Tip 1: Consistent Practice is Key - Dedicate time daily to practicing coding problems, working on projects, and reviewing concepts. Consistency helps solidify your understanding and improve problem-solving skills.
Tip 2: Learn from Mistakes - Don't be discouraged by mistakes or failures. Instead, embrace them as learning opportunities. Analyze what went wrong, understand the gaps in your knowledge, and strive to improve with each setback.
Tip 1: Highlight Relevant Projects - Showcase your practical skills by including projects that demonstrate your abilities and align with the job you're applying for. Describe the project's scope, your role, the technologies used, and the problems you solved.
Tip 2: Tailor Your Resume - Customize your resume for each job application by focusing on the skills and experiences most relevant to the position. This shows your genuine interest and makes your resume stand out.



Given maze: {[0, 0, 1], [1, 0, 0], [1, 0, 0]}
Starting point: [2, 2]
Destination: [0, 0]
For the above example maze will look like this:

So, we can see there are 2 ways for Ninja to reach destination(D), from the starting point(SP). They are: [left -> up -> left] and [up -> left -> up -> left].
So, you need to print true.



1. DIST[i][j] = DIST[j][i].
2. DIST[i][i] = 0.
Consider that there are 4 cities i.e. ‘N’ = 4, and the distance between each pair of cities is given by the following matrix ‘DIST’:
[0, 10, 7, 6]
[10, 0, 8, 5]
[7, 8, 0, 12]
[6, 5, 12, 0]
Graphically, cities can be represented as -:

Assume Ninjas wants to install a server in 2 cities i.e ‘K’ = 2. Then one optimal choice is to select cities 2 and 3.
After that, the minimum distance of city 0 from the server is 6 (i.e from city 2).
The minimum distance of city 1 from the server is 5 (i.e from city 3).
The minimum distance of cities 2 and 3 from the server is 0, as the server is installed in these cities.
Thus the maximum distance of the city from the server is max (6, 5, 0, 0) = 6.
So, we should return 6.
No selection of two cities can give a maximum distance which is less than 6.
long long solve(){
int ha,hb,hc,ab,bc,ac;
cin>>ha>>hb>>hc>>ac>>ab>>bc;
unordered_map map;
map[1]=ha;
map[2]=hb;
map[3]=hc;
map[12]=ab;
map[21]=ab;
map[13]=ac;
map[31]=ac;
map[23]=bc;
map[32]=bc;
long long ans = LONG_MAX;
for (long long i = 1; i <= 3; i++) {
for (long long j = 1; j <= 3; j++) {
if (i != j) {
long long one = map[i] + map[j] + map[i * 10 + j];
long long two = 2 * (map[i] + map[i * 10 + j]);
long long three = 2 * (map[j] + map[i * 10 + j]);
long long four = 2 * (map[j] + map[j]);
ans = min(ans, min(one, min(two, min(three, four))));
}
}
}
return ans;
}


1. ‘.’ matches to any single character.
2. ‘*’ matches to zero or more of the preceding element.
1. You have to match the entire string with the pattern given.
2. Both the strings, 'S' and 'P' contain only lower-case alphabets.
3. Only the pattern will contain additional characters ‘*’ and ‘.’ along with alphabets.
#include
#include
using namespace std;
class Solution {
public:
bool isMatch(string s, string p) {
int m = s.length();
int n = p.length();
// Create a 2D table to store the matching results
vector> dp(m + 1, vector(n + 1, false));
// Base case: an empty string and an empty pattern match
dp[0][0] = true;
// Fill the first row of the table
// If the pattern contains '*' and the previous character in the pattern matches the current character in the string,
// then the current position in the table matches.
for (int j = 1; j <= n; j++) {
if (p[j - 1] == '*') {
dp[0][j] = dp[0][j - 2];
}
}
// Fill the remaining positions of the table
for (int i = 1; i <= m; i++) {
for (int j = 1; j <= n; j++) {
// If the current characters match or the pattern contains '.',
// then the current position in the table matches the previous position.
if (s[i - 1] == p[j - 1] || p[j - 1] == '.') {
dp[i][j] = dp[i - 1][j - 1];
}
// If the pattern contains '*', we have two cases:
// 1. The '*' matches zero preceding element, then check if the pattern without '*' matches the current string.
// 2. The '*' matches one or more preceding elements, then check if the current character in the string matches the preceding character in the pattern,
// and the current position in the table matches the previous position or the current position matches the position before the preceding character in the pattern.
else if (p[j - 1] == '*') {
dp[i][j] = dp[i][j - 2]; // case 1
if (p[j - 2] == '.' || p[j - 2] == s[i - 1]) {
dp[i][j] = dp[i][j] || dp[i - 1][j]; // case 2
}
}
}
}
return dp[m][n];
}
};


'S' = "{}()".
There is always an opening brace before a closing brace i.e. '{' before '}', '(' before ').
So the 'S' is Balanced.



N = 5
JUMP = [1,2,3,4,5]
ANSWER:- The answer should be YES as you can jump from 1st index to 2nd index, from 2nd index to 4th index, and from 4th index to 5th index.




Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
What is the output of print(type("Python"))?