# Please give the solution of samsung hiring challenge

I am not able to solve the questions of Samsung hiring challenge. But I want to know the solution of the problem. They did not provide any editorial or to see others successful submissions. Anyone who got AC in contest please give me the solution .

I only have a copy of 2nd and 3rd question.Here it is

Well I solved First Problem And I will explain it if u want.And I am interested In second and 3rd solution.So plzz sm1 tell me

i don’t have question.can you give me question of samsung hiring challenge??

Solution of the first question: https://ide.geeksforgeeks.org/rXUpQihfjo

2nd Question.

First preprocess sum of all n\$^2\$ subarrays.

dp[i][j] represents max value by dividing first i elements into j subarrays.
you can calculate as

dp[i][j]=max\$_{k=1\ to\ i-1}\$(dp[i-k][j-1]+sum[i-k+1][i]).
Here sum[i][j] means sum of all elements from i to j.

There are O(n*k) dp states and each state computed in O(n) time.

Time O(n\$^2\$k)
Space O(nk)

Anybody got an email for samsung onsite test? I wanted to know if that mail is the result of the online hiring challenge or something random. The center is quite far from my place, so I want to know if the trip would be worth the trouble.

can you please explain 1st? I was able to get 48 in that… I will explain 2nd in a comment soon.