#DailyCodingChallenge
Day 360
Task: Form the smallest number using digits from both arrays.
Solution: If a common digit exists, return the smallest one; otherwise, combine the smallest digits from both arrays.
#LeetCode
#DailyCodingChallenge
Day 359
Task: Find the minimum flips needed to make a binary string equal to its reverse.
Solution: Compare the string with its reverse and count mismatched positions.
#LeetCode
#DailyCodingChallenge
Day 358
Task: Count how many devices can be tested after sequential battery reductions.
Solution: Track tested count and check if current battery minus previous reductions is still greater than zero.
#LeetCode
#DailyCodingChallenge
Day 357
Task: Find the maximum difference by remapping one digit in the number.
Solution: Replace a digit to 9 for maximum and another to 0 for minimum, then return their difference.
#LeetCode
#DailyCodingChallenge
Day 356
Task: Find the longest subarray that is strictly increasing or strictly decreasing.
Solution: Traverse the array, track lengths of increasing and decreasing sequences, and keep the maximum.
#LeetCode
#DailyCodingChallenge
Day 355
Task: Find the shortest distance to reach the target string in a circular array.
Solution: For each occurrence of target, calculate both clockwise and counterclockwise distances and take the minimum.
#LeetCode
#DailyCodingChallenge
Day 354
Task: Replace hidden digits to form the latest valid time.
Solution: Fill each '?' with the maximum possible digit while keeping the time valid (hour ≤ 23, minute ≤ 59).
#LeetCode
#DailyCodingChallenge
Day 352
Task: Check if all strings can be made equal by redistributing characters.
Solution: Count total frequency of each character and ensure each is divisible by the number of strings.
#LeetCode
#DailyCodingChallenge
Day 351
Task: Find the shortest subarray whose bitwise OR is at least k.
Solution: Try all subarrays, compute OR incrementally, and track the minimum length when OR ≥ k.
#LeetCode
#DailyCodingChallenge
Day 350
Task: Find the first even number in the array that appears exactly once.
Solution: Count frequencies using a map, then return the first even number with frequency one.
#LeetCode
#DailyCodingChallenge
Day 349
Task: Check if the array forms a valid mountain shape (strictly increasing then decreasing).
Solution: Traverse up while increasing, then down while decreasing, and ensure the peak is not at the ends.
#LeetCode
#DailyCodingChallenge
Day 348
Task: Find the maximum number of pairs where one string is the reverse of another.
Solution: Use a set to store words and form a pair when the reversed word already exists.
#LeetCode