## Brossh Interview Question for Developer Program Engineers

• 0

Country: Isreal
Interview Type: Written Test

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

Python script:

``````def exercise(some_list):
if len(some_list) < 2:
return some_list

working_list = [some_list[0]]
max_list = []

for element in some_list[1:]:
if working_list[-1] < element:
working_list.append(element)

if len(working_list) > len(max_list):
max_list = working_list
else:
working_list = [element]

return max_list

print(exercise([16, 4, 8 ,22, 33, 7, 71]))``````

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

For the example you gave - {16, 4, 8 ,22, 33, 7, 71}, shouldn't the longest ascending subsequence be -> [4,8,22,33,71] instead of [16,22,33,71] as you wrote in question description?

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

The most classic dynamic programming problem I know :).

``````dp[1] = 1
for i = 2, n do
dp[i] = 1
pred[i] = i
for j = 1,i do
if a[i] < a[j] and dp [i] < dp[j] + 1
dp[i] = dp[j] + 1
pred[i] = j``````

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

``````#include<stdio.h>
#include<stdlib.h>
void main()
{
int i, j, *arr, c=0, s=0;
printf("Enter the number of elements: ");
scanf("%d", &i);
arr=(int *)malloc(i*sizeof(int));
for(j=0; j<i; j++)
{
printf("Enter the element no. %d: ", j+1);
scanf("%d", &arr[j]);
}
for(j=0; j<i; j++)
{
if(arr[j]<arr[j+1])
c++;
else
{
if(c>s)
s=c;
c=0;
}

}
printf("The largest sequence is: %d", s+1);

}``````

see if this works

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.