Daily practice competitive programming Question
Day 1:
p1: Largest Element in an array. i/p: arr[]={10,5,20,8} o/p: 2 //index of 20
p2: Second Largest Element in an array. i/p: arr[]={10,5,8,20} o/p: 0 //index of 10
Day 3:
p1: check if an array is sorted. i/p: arr[]={8,12,15} o/p: YES i/p: arr[]={100,20,200} o/p: No
p2: Reverse an Array. i/p: arr[]= {10,5,7,30} o/p: arr[]={30,7,5,10}
p3:Remove duplicates from a sorted array. i/p: arr[]={10,20,20,30,30,30,30} size=7 o/p: arr[]={10,20,30,,,,} size=3
Day 4:
p1: Move Zeros to End. i/p: arr[]={8,5,0,10,0,20} o/p: arr[]={8,5,10,20,0,0}
p2: Left Rotate an Array by one. i/p: arr[]={1,2,3,4,5} o/p: arr[]={2,3,4,5,1}
p3: Left Rotate an Array by d. i/p: arr[]={1,2,3,4,5} d=2 o/p: arr[]={3,4,5,1,2}
Day 5:
p1: Leaders in an Array problem. i/p: arr[]={7,10,4,3,6,5,2} o/p: 10,6,5,2 i/p: arr[]={10,20,30} o/p: 30
p2: Maximum Difference problem with order. i/p: arr[]={2,3,10,6,4,8,1} o/p: 8
p3: Frequencies in a sorted array. i/p: arr[]={10,10,10,25,30,30} o/p: 10 3 25 1 30 2