"bool isConsecutive(int arr[], int n)
{
// base case
if (n max) {
max = arr[i];
}
}
// for an array to contain consecutive integers, the difference between
// the maximum and minimum element in it should be exactly \n-1\
if (max - min != n - 1) {
return false;
}
// create an empty set (we can also use a visit"
Hinata T. - "bool isConsecutive(int arr[], int n)
{
// base case
if (n max) {
max = arr[i];
}
}
// for an array to contain consecutive integers, the difference between
// the maximum and minimum element in it should be exactly \n-1\
if (max - min != n - 1) {
return false;
}
// create an empty set (we can also use a visit"See full answer
"This is a Technical question. It tests your ability to understand high level technical concepts. Even though your job won't have any coding involved, you'll still need to understand these concepts. Being able to cover all these topics with clarity communicates confidence in your interviewer.
Unfortunately, there's no formula for technical questions, but some general tips are:
Use analogies when you can
Break your solution into clear, bite-size steps
Don't be afraid to use examples to b"
Exponent - "This is a Technical question. It tests your ability to understand high level technical concepts. Even though your job won't have any coding involved, you'll still need to understand these concepts. Being able to cover all these topics with clarity communicates confidence in your interviewer.
Unfortunately, there's no formula for technical questions, but some general tips are:
Use analogies when you can
Break your solution into clear, bite-size steps
Don't be afraid to use examples to b"See full answer
"Before we begin, it's important to understand what the interviewer is testing with this type of question. This is a Strategy Question that tests an interviewee's ability to create compelling arguments from high level information, discern motive, and think strategically. We can split this question into two parts: Why is Amazon buying retailers and why is Amazon keeping them independent?
Why is Amazon buying retailers?
> To start, let's go over some recent examples of Amazon buying retail c"
Exponent - "Before we begin, it's important to understand what the interviewer is testing with this type of question. This is a Strategy Question that tests an interviewee's ability to create compelling arguments from high level information, discern motive, and think strategically. We can split this question into two parts: Why is Amazon buying retailers and why is Amazon keeping them independent?
Why is Amazon buying retailers?
> To start, let's go over some recent examples of Amazon buying retail c"See full answer
"My brute force approach was to read them. Give a id to each paragraph and for each token count the number of time it has appeared. If any two rows look same , it is duplicated. Further , interviewer guided me that he will do it with hashing."
Payal B. - "My brute force approach was to read them. Give a id to each paragraph and for each token count the number of time it has appeared. If any two rows look same , it is duplicated. Further , interviewer guided me that he will do it with hashing."See full answer
"The idea of prefix sum can be applied here to find a product prefix array and a product suffix array.
Create a prefix product array by calculating the cumulative product of all elements which appear before that particular element in the array.
Similarly, create a suffix array for all elements which appear later than particular element in the array.
Now, replace each element with the product of prefix and suffix products of adjacent elements. This will give you the answer."
Somdip S. - "The idea of prefix sum can be applied here to find a product prefix array and a product suffix array.
Create a prefix product array by calculating the cumulative product of all elements which appear before that particular element in the array.
Similarly, create a suffix array for all elements which appear later than particular element in the array.
Now, replace each element with the product of prefix and suffix products of adjacent elements. This will give you the answer."See full answer
"static int findLongestRepeatingSubSeq(String str)
{
int n = str.length();
int dp = new intn+1;
for (int i=0; i<=n; i++)
for (int j=0; j<=n; j++)
dpi = 0;
for (int i=1; i<=n; i++)
{
for (int j=1; j<=n; j++)
{
if (str.charAt(i-1)== str.charAt(j-1) && i != j)
dpi =Â 1 + dpi-1;
else
dpi = Math.max(dpi, dpi-1);
}
}
`return"
Padmanaban M. - "static int findLongestRepeatingSubSeq(String str)
{
int n = str.length();
int dp = new intn+1;
for (int i=0; i<=n; i++)
for (int j=0; j<=n; j++)
dpi = 0;
for (int i=1; i<=n; i++)
{
for (int j=1; j<=n; j++)
{
if (str.charAt(i-1)== str.charAt(j-1) && i != j)
dpi =Â 1 + dpi-1;
else
dpi = Math.max(dpi, dpi-1);
}
}
`return"See full answer