Subhradeep Sahasubhradeepsaha.hashnode.dev·May 19, 2024Solving a Leetcode problem daily — Day 12 | 347. Top K frequent elementshttps://blog.devgenius.io/solving-a-leetcode-problem-daily-day-12-347-top-k-frequent-elements-63afa6f681f3 Here is the Leetcode problem link —347. Top K frequent elements Problem Statement Given an integer array nums and an integer k, return thek...DiscussSolving a Leetcode problem daily347
Maksim MartianovPromartianov.dev·May 18, 2024Unlocking Scala Mastery with my leetcode Solutions ArchiveIntroduction I have decided to dump my personal leetcode solutions archive. Currently it contains Scala solutions only. I will eventually publish all the remaining solutions in GO, JS and PHP and others. These solutions have been collected over years...Discuss·30 readsScala
Umang Srivastavaoutlierchronicles.hashnode.dev·May 18, 202422. Generate ParenthesesProblem Statement Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. Examples Example 1: Input: n = 3 Output: ["((()))","(()())","(())()","()(())","()()()"] Example 2: Input: n = 1 Output: ["()"] ...Discuss·10 likesRecursionleetcode
Gulshan Kumarperfinsights.hashnode.dev·May 18, 2024Find the Winner of the Circular GameThere are n friends that are playing a game. The friends are sitting in a circle and are numbered from 1 to n in clockwise order. More formally, moving clockwise from the i<sup>th</sup> friend brings you to the (i+1)<sup>th</sup> friend for 1 <= i < ...Discuss·1 likeJava SolutionJava
Tapan Rachchhtapanrachchh.hashnode.dev·May 18, 2024979. Distribute Coins in Binary Tree# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def distributeCoins(self, root: Option...DiscussPython
Gulshan Kumarperfinsights.hashnode.dev·May 18, 2024Maximum Score After Splitting a StringGiven a string s of zeros and ones, return the maximum score after splitting the string into two non-empty substrings (i.e. left substring and right substring). The score after splitting a string is the number of zeros in the left substring plus the ...DiscussJava SolutionJava
Gulshan Kumarperfinsights.hashnode.dev·May 18, 2024Row With Maximum OnesGiven a m x n binary matrix mat, find the 0-indexed position of the row that contains the maximum count of ones, and the number of ones in that row. In case there are multiple rows that have the maximum count of ones, the row with the smallest row nu...DiscussJava Solutionarray
Gulshan Kumarperfinsights.hashnode.dev·May 18, 2024Calculate Delayed Arrival TimeYou are given a positive integer arrivalTime denoting the arrival time of a train in hours, and another positive integer delayedTime denoting the amount of delay in hours. Return the time when the train will arrive at the station. Note that the time ...DiscussJava SolutionJava
Gulshan Kumarperfinsights.hashnode.dev·May 18, 2024Check if Grid Satisfies ConditionsYou are given a 2D matrix grid of size m x n. You need to check if each cell grid[i][j] is: Equal to the cell below it, i.e. grid[i][j] == grid[i + 1][j] (if it exists). Different from the cell to its right, i.e. grid[i][j] != grid[i][j + 1] (if it...DiscussJava SolutionJava
Gulshan Kumarperfinsights.hashnode.dev·May 18, 2024Permutation Difference between Two StringsYou are given two strings s and t such that every character occurs at most once in s and t is a permutation of s. The permutation difference between s and t is defined as the sum of the absolute difference between the index of the occurrence of each ...DiscussJava SolutionJava