Uses map for storing the ranges and additional array for storing the result.
Hence, time complexity: O(1), space complexity: O(1)
removed by moderator
Uses map for storing the ranges and additional array for storing the result.
Hence, time complexity: O(1), space complexity: O(1)
removed by moderator
Welcome to the forum @vrs23.92!
You can post solutions that invite discussion (like asking how the solution works, or asking about certain parts of the solution). But please don’t just post your solution for the sake of sharing it.
If you post a full passing solution to a challenge and have questions about it, please surround it with [spoiler] and [/spoiler] tags on the line above and below your solution code.
Happy coding!