JNAYEH Sirinesirinejnayeh.hashnode.dev·11 hours agoBinary Lifting: My First Time Applying DP on Binary TreesBinary lifting is causing a revolution in tree-based computations, offering a clever way to handle complex tree queries efficiently. This dynamic programming approach allows for quick navigation through tree structures, making it a game-changer for v...DiscussBinaryTrees
Dominick J. Monacodominickjmonaco.hashnode.dev·Jul 24, 2024Tackling the C-Shape Challenge: A FAANG interview stapleKicking things off! Welcome to the first entry in my new blog post series, where I'm taking a leaf out of Brian Douglas's hat from OpenSauced. I'll be diving into the world of LeetCode style interview questions, sharing my experiences and solutions f...Discuss·15 likes·100 readsLearning Data Structures and Using Algorithms.leetcode
Madhav Ganesanmadhavganesan.hashnode.dev·Jul 25, 2024String for CP (DSA - 2)Automatic removal of trailing and leading spaces in a string: stringstream data structure handles the removal of trailing and leading spaces automatically #include <sstream> using namespace std; void func(string s){ stringstream ss(s); vector<std::...DiscussDSA
Carol Dsilvacaroldsillva.hashnode.dev·Jul 23, 2024Day 08 of 100 Days of Code: Basic Math and Leet code questionsI did 3 Basic Math questions on leetcode- reverse, palindrome and counting digits that are divisible as a continuation to the sheet. I found the counting digits that are divisible quite interesting. i ran into an error when I ran the reverse question...Discuss100DaysOfCode
Tapan Rachchhtapanrachchh.hashnode.dev·Jul 23, 20241636. Sort Array by Increasing Frequencyclass Solution: def frequencySort(self, nums: List[int]) -> List[int]: c = Counter(nums) v = [x[0] for x in sorted(c.items(), key=lambda x:(x[1], -1 * x[0]))] ans = [] for num in v: ans += [nu...Discussleetcode
Chetan Dattachetan77.hashnode.dev·Jul 22, 2024Matrix MedianProblem Given a row wise sorted matrix of size R*C where R and C are always odd, find the median of the matrix. (link) Example 1: Input: R = 3, C = 3 M = [[1, 3, 5], [2, 6, 9], [3, 6, 9]] Output: 5 Explanation: Sorting matrix elements giv...DiscussLeetcodeMatrix-Median
Ajay Dandgenobleknight.hashnode.dev·Jul 22, 2024LeetCode #2392 Build a Matrix With Conditions, Topological Sort and Kahn's AlgorithmYou are given a positive integer k. You are also given: a 2D integer array rowConditions of size n where rowConditions[i] = [above<sub>i</sub>, below<sub>i</sub>], and a 2D integer array colConditions of size m where colConditions[i] = [left<sub>i<...Discussleetcode
Haneunhanlee.hashnode.dev·Jul 22, 2024LeetCode 1518. Water Bottles Java SolutionProblem Description Problem: LeetCode 1518. Water Bottles Description: We have numBottles water bottles. We can exchange numExchange empty bottles for one new full water bottle. The goal is to calculate the maximum number of water bottles we can dr...Discuss LeetCode 1518. Water Bottles
Jay Choukseyjayjava.hashnode.dev·Jul 22, 2024Increasing Triplet SubsequenceIntroduction Today, I tackled an interesting medium-level problem from LeetCode: Increasing Triplet Subsequence. This problem requires a good understanding of arrays and greedy algorithms. The goal is to determine if there exists a triplet in the arr...DiscussJava
Nawat Sunthornyanakitearthcode.hashnode.dev·Jul 22, 2024Linked List Cycle (Leetcode #141)Given head, the head of a linked list, determine if the linked list has a cycle in it. There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the next pointer. Internally, pos is used t...Discussleetcode