Greetings, connections💓!
I participated in CodeForces (Div. 2) Contest. I was able to solve Three Problems only. I found problem statements quite hard to understand, anyway Lets discuss the Solutions.
𝐏𝐫𝐨𝐛𝐥𝐞𝐦 𝐀
To divide all numbers into two different arrays following the pattern (max, min, second max, second min, etc.), first, sort the input array in ascending order. Then, alternate elements between the two arrays: add the largest remaining element to the first array and the smallest remaining element to the second array, and continue this process until all elements are distributed. Finally, calculate the sum of the absolute differences between corresponding elements of the two arrays.
𝐒𝐨𝐥𝐮𝐭𝐢𝐨𝐧 -> https://lnkd.in/g6yznBci
𝐏𝐫𝐨𝐛𝐥𝐞𝐦 𝐁
To minimize the oneness of a binary string, we defined the counts of subsequences with only zeroes and those with at least one one. By choosing a string with all zeroes except for one one at the end, we balanced these counts effectively. This configuration ensures the smallest possible oneness. Thus, the optimal string consists of all zeroes followed by a single one.
𝐒𝐨𝐥𝐮𝐭𝐢𝐨𝐧 -> https://lnkd.in/ghAFkQai
𝐏𝐫𝐨𝐛𝐥𝐞𝐦 𝐂
To determine if Alice can win, we check the positions of "1"s in the binary string. If a "1" is at the beginning, end, or adjacent to another "1," it indicates that Alice can secure a true outcome. This is because these configurations allow Alice to influence the final evaluation in her favor. If none of these conditions are met, Bob can manipulate the operators to ensure the result is false.
𝐒𝐨𝐥𝐮𝐭𝐢𝐨𝐧 -> https://lnkd.in/gVsRgmQz
Will try to do better next time. Overall a great contest Indeed.
This is all from my side 🤝 Follow : Mohit Budhlakoti
#leetcode #weeklycontest #problemoftheday #contest #rank #biweeklycontest #codeforces #div2 #coding
Hiring for Software Developer (Backend, Frontend developer)
1wHappy Birthday Geeta Singh. Wishing you the best on your birthday and everything good in the year ahead. 🙂