CodeAgon 2023 by Trilogy Innovations was held today. We can use this blog to discuss the problems and their approaches. I personally solved 2.5 problems, 1st , 4th and 5th partial (300 points). Would be interested in knowing the solutions for the others.↵
↵
My Approaches:↵
↵
Problem 1: ↵
Sort the array and find median. Try changing 1st two elements, last 2 elements, and 1st and last elements to the median, and try to find the optimal answer out of these 3 cases.↵
↵
Problem 4:↵
Solved it with DP,where DP[i] = expected steps for number i, Transistion -> dp[i] = (sum of (dp[div] + 1) for all divisors of i except 1) / count of divisors of i. The required answer is sum of dp[i] for all 1 to n, divided by n.↵
↵
Problem 5: ↵
Did it partially with approach similar to this [Problem](https://leetcode.com/problems/insert-interval/).↵
↵
↵
Would love to hear your approaches too.↵
↵
Thanks.
↵
My Approaches:↵
↵
Problem 1: ↵
Sort the array and find median. Try changing 1st two elements, last 2 elements, and 1st and last elements to the median, and try to find the optimal answer out of these 3 cases.↵
↵
Problem 4:↵
Solved it with DP,where DP[i] = expected steps for number i, Transistion -> dp[i] = (sum of (dp[div] + 1) for all divisors of i except 1) / count of divisors of i. The required answer is sum of dp[i] for all 1 to n, divided by n.↵
↵
Problem 5: ↵
Did it partially with approach similar to this [Problem](https://leetcode.com/problems/insert-interval/).↵
↵
↵
Would love to hear your approaches too.↵
↵
Thanks.




