Brossh Interview Question for Developer Program Engineers


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]))

- Practitioner December 11, 2018 | Flag Reply
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?

- Shubham December 21, 2018 | Flag Reply
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

- p.andrey January 16, 2019 | Flag Reply


Add a Comment
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.

Learn More

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.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More