Tip 1 : Practice Data structures as much as possible at least try to solve 4-5 problems every day. Take any one platform and practice regularily
Tip 2 : Create 3-4 Descent projects. It's good to have some different and unique projects that solve any current problem. Everyone came with some famous clones instead of that take unique problem.
Tip 3 : Along with DSA and project also focus on System design concepts and problems.
Tip 1 : Add a clickable profile link of any coding platform
Tip 2 : Add clickable hosted links to each project.
Tip 3 : Do not add irrelevant projects, or achievements to the job role or job stream.



Input: ‘L’ = ‘1’ , 'R' = ‘3’
Output: 1
As ‘1’ is the only Beautiful Number.
3 is not Beautiful as,
3 -> 9
9 -> 81
81 -> 65
65 -> 61 … and so on
It can be shown that we cannot get 1.
import java.io.*;
import java.nio.Buffer;
import java.util.*;
public class TestClass {
public static void main(String[] args) throws IOException {
long preProsArr[] = preprocess();
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter wr = new PrintWriter(System.out);
int T = Integer.parseInt(br.readLine().trim());
for(int t_i = 0; t_i < T; t_i++)
{
String[] str = br.readLine().split(" ");
int l = Integer.parseInt(str[0]);
int r = Integer.parseInt(str[1]);
wr.write(preProsArr[r] - preProsArr[l - 1] + "\n");
}
wr.close();
br.close();
}
static boolean check(int u){
int cnt = 40;
while(cnt > 0 && u != 4){
int ans = 0;
while(u > 0){
ans += (u % 10) * (u % 10);
u /= 10;
}
u = ans;
cnt--;
if(u == 1) {
return true;
}
}
return false;
}
static long[] preprocess() {
long preProsArr[] = new long[1000005];
for(int i = 1; i <= 1000000; i++){
if(check(i)){
preProsArr[i] = i;
}
}
for(int i = 1; i <= 1000000; i++){
preProsArr[i] += preProsArr[i-1];
}
return preProsArr;
}
}

3 tasks and 16 units of total time.
Task = [( 2, 8 ) , ( 4, 5) , ( 5, 1)]
( 2, 8 ) -> task 1 at position 2 in line and takes 8 sec to complete.
( 4, 5) -> task 2 at position 4 in line and takes 5 sec to complete.
( 5, 1) -> task 3 at position 5 in line and takes 1 sec to complete.
Skipping the first task leaves us enough time to complete the other two tasks. Going to the location of the third task and coming back costs 2x5 =10 sec, and performing tasks at locations 4 and 5 cost us 5+1 = 6 sec.
Total time spent will be 10+6=16 sec.



Iterate over each row and column for each iteration of row and column Take one set and keep on adding elements to set. Before adding to set check whether that element is already present in set or not. if element is present in set then duplicate is found so it is not follwing rules so return false. and at the end return true as no duplicate is found.



You must sell the stock before you buy it again.
// Java program for the above approach
import java.io.*;
class GFG
{
static int maxProfit(int prices[], int size)
{
// maxProfit adds up the difference between
// adjacent elements if they are in increasing order
int maxProfit = 0;
// The loop starts from 1
// as its comparing with the previous
for (int i = 1; i < size; i++)
if (prices[i] > prices[i - 1])
maxProfit += prices[i] - prices[i - 1];
return maxProfit;
}
// Driver code
public static void main(String[] args)
{
// stock prices on consecutive days
int price[] = { 100, 180, 260, 310, 40, 535, 695 };
int n = price.length;
// function call
System.out.println(maxProfit(price, n));
}
}
The interviewer was a very nice guy and he continuously gave me hints to get the correct answers from me.




To solve this problem, divide problem in 2 parts, first outer square box diagonals of it. so we can iterate like 2d array of N*N size and print star if it is edge point or digonal point.
The interviewer was of descent type. He was testing overall personality.
Tip 1 : Prepare well with a type of behavioral question. These are the common questions that are asked in HR interviews.
Tip 2 : Show the interviewer that you are ready to learn new technologies and you are a quick learner.
Tip 3 : Answer only what the interviewer wants to listen from you. do not mention any previous conflicts you had in the previous organisation.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
How do you remove whitespace from the start of a string?