## Cadence Inc Interview Question for Development Support Engineers

Country: India
Interview Type: In-Person

Comment hidden because of low score. Click to expand.
1
of 1 vote

Can anyone explain the problem? What is the meaning of k contiguous row-wise elements?

Comment hidden because of low score. Click to expand.
0
of 0 vote

I wrote the following code and took n=5 and k=3. But it doesnt work. Can someone help me out please

``````#include <bits/stdc++.h>
using namespace std;

int main() {
int n=5;
int arr[5][5];
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
cin>>arr[i][j];
}
}
int k=3;
int sum=0, ans=INT_MAX, count=0;
for(int i=0;i<n;i++)
{
for(int j=0;j<n-k;j++)
{
while(count<k && arr[i][j+count]==1)
{
sum=sum+ pow((n/2-i),2)+ pow((n/2-j-count),2);
count++;
}
if(sum<ans && sum!=0)
ans=sum;
sum=0;
count=0;
}
}
cout<<ans<<endl;
return 0;
}``````

Comment hidden because of low score. Click to expand.
0
of 0 vote

Can you please share a sample input - output. It will help us in understanding the problem.

Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

### Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

### Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.