1 day agoLeetCode 1207. Unique Number of OccurrencesGiven an array of integers arr, return true if the number of occurrences of each value in the array is unique or false otherwise. Example 1: Input: arr = [1,2,2,1,1,3] Output: true Explanation: The value 1 has 3 occurrences, 2 has 2 and 3 has 1. …Leetcode2 min readLeetcode2 min read
1 day agoLeetCode 1010. Pairs of Songs With Total Durations Divisible by 60You are given a list of songs where the ith song has a duration of time[i] seconds. Return the number of pairs of songs for which their total duration in seconds is divisible by 60. …Leetcode3 min readLeetcode3 min read
2 days agoLeetCode 869. Reordered Power of 2If you prefer a quick walk through: You are given an integer n. We reorder the digits in any order (including the original order) such that the leading digit is not zero. Return true if and only if we can do this so that the resulting number is a…Leetcode3 min readLeetcode3 min read
6 days agoLeetCode 1404. Number of Steps to Reduce a Number in Binary Representation to OneIf you prefer a quick walk through: Given the binary representation of an integer as a string s, return the number of steps to reduce it to 1 under the following rules: If the current number is even, you have to divide it by 2. If the current number…Leetcode5 min readLeetcode5 min read
Jan 24LeetCode 1218. Longest Arithmetic Subsequence of Given Difference SolutionGiven an integer array arr and an integer difference, return the length of the longest subsequence in arr which is an arithmetic sequence such that the difference between adjacent elements in the subsequence equals difference. A subsequence is a sequence that can be derived from arr by deleting some or…Leetcode4 min readLeetcode4 min read
Jan 10LeetCode 959. Regions Cut By SlashesIf you prefer a video walk through: An n x n grid is composed of 1 x 1 squares where each 1 x 1 square consists of a '/', '\', or blank space ' '. These characters divide the square into contiguous regions. Given the grid grid represented as…Leetcode5 min readLeetcode5 min read
Dec 21, 2022LeetCode solutionsLeetCode Permutations II LeetCode Shortest Path in Binary Matrix LeetCode Satisfiability of Equality Equations LeetCode Find All Possible Recipes From Given Supplies LeetCode Minesweeper LeetCode Snapshot Array LeetCode Another problem LeetCode Restore IP Addresses LeetCode Kth Missing Positive Number LeetCode Akuna OA #1 — Max Sum Subarray with Length <=…Leetcode1 min readLeetcode1 min read
Sep 14, 2022Google Interview Questions 2022 Solutions and Detailed ExplanationsMost common asked Google interview questions Going for your Google interview? These are the questions most asked in 2022 with detailed editorial explanations and solutions in three languages: LeetCode 1101. The Earliest Moment When Everyone Become Friends Solution LeetCode 1697. Checking Existence of Edge Length Limited Paths Solution LeetCode 1048. Longest String Chain Solution LeetCode 1423…Coding Interviews1 min readCoding Interviews1 min read
Nov 20, 2021Python TreeMapWhat is a TreeMap? A self-balancing binary search tree. In modern languages, this is normally implemented as a Red-black tree. TreeMap Time Complexity Java TreeMap Java has collection library support (java.util.TreeMap) for TreeMap. C++ TreeMap C++’s std::map is a red-black tree TreeMap Implementation. Note that name is rather tricky here. std::map is TreeMap(ordered) and the more common hashmap is actually std::unordered_map.Algorithms3 min readAlgorithms3 min read
Nov 2, 2021Amazon OA 2022 HackerrankMax Profit Find Lowest Price Simple Cipher Decode String Frequency Coin Sequence Count Max Teams Valid Coupons1 min read1 min readAmazon OA 2022 HackerrankMax ProfitFind Lowest PriceSimple CipherDecode String FrequencyCoin SequenceCount Max TeamsValid Coupons----