1. You have an array of numbers. Need to find the abs diff between alpha count and beta count. where alpha count is the sum of the entries in the array, where those entries should be consecutive and should be of same value and the value and the consecutive count should match. beta count is same as alpha additionally the starting index of entries should start from the value itself.
For eg: arr[2,2,2,4,4,4,4,1,2,2]
alpha entries are [4,4,4,4] [1] [2,2] , because value 4 is 4 times consecutive, value 1 is 1 time consecutive, value 2,2 is 2 times consecutive.
Beta entries are [4,4,4,4] value 4 starting index is 4, which is same as the value itself.
output should be abs[alpha_count-beta_count].
2. You have a 2 dimensional array arr[i, 3], where as arr[i][0] is a person name, arr[i][1] is another person name, arr[1][3] is a value(can be negative also). Need to sum the values of arr[i][0] and subtract it with sum of the values of arr[i][1] with the condition that person name is same. Find the list of person whose final amount is lesser than .
For eg:
arun balu 3
balu arun 2
gopi arun 3
balu gopi 4
then
arun=(3)-(2+3)=-2
balu=(2+4)-(3)=3
gopi=(3)-(4)=-4
op: "gopi".