Open in app

Sign In

Write

Sign In

Jyothi
Jyothi

12 Followers

Home

About

Feb 11

Finding median of a stream

Basic idea is to use two heaps here. min-heap and max-heap. First half of elements are maintained using max-heap and next half of elements are maintained using min-heap. Median is found using the root elements of max heap and min heap. I have written the below python code. …

Finding Median

3 min read

Finding Median

3 min read


May 1, 2022

Optimize Water Distribution in a Village

There are n houses in a village. We want to supply water for all the houses by building wells and laying pipes. For each house i, we can either build a well inside it directly with cost wells[i - 1] (note the -1 due to 0-indexing), or pipe in water…

Water Distribution Graphs

2 min read

Water Distribution Graphs

2 min read


Apr 25, 2022

Evaluate Division

You are given an array of variable pairs equations and an array of real numbers values, where equations[i] = [Ai, Bi] and values[i] represent the equation Ai / Bi = values[i]. Each Ai or Bi is a string that represents a single variable. You are also given some queries, where…

Evaluate Division

6 min read

Evaluate Division

6 min read


Apr 22, 2022

Uplink channel mappings

There are 3 types of channels: Logical channels. Logical channels transfer data between RLC and MAC layer. This data is called RLC PDU. CCCH(Common Control channel), DCCH (Dedicated control channel) and DTCH(Dedicated traffic channel) are uplink logical channels mapped to ULSCH transport channel. CCCH and DCCH are used to transfer…

Uplink Channel Mappings

2 min read

Uplink Channel Mappings

2 min read


Apr 18, 2022

Smallest String With Swaps

Problem statement You are given a string s, and an array of pairs of indices in the string pairs where pairs[i] = [a, b] indicates 2 indices(0-indexed) of the string. You can swap the characters at any pair of indices in the given pairs any number of times. Return the…

Smallest Stringswaps

2 min read

Smallest Stringswaps

2 min read


Apr 13, 2022

Number of Connected Components in an Undirected Graph

Problem statement: You have a graph of n nodes. You are given an integer n and an array edges where edges[i] = [ai, bi] indicates that there is an edge between ai and bi in the graph. Return the number of connected components in the graph. This is another example…

Connected Components

1 min read

Connected Components

1 min read


Apr 13, 2022

graph valid tree

Problem statement You have a graph of n nodes labeled from 0 to n - 1. You are given an integer n and a list of edges where edges[i] = [ai, bi] indicates that there is an undirected edge between nodes ai and bi in the graph. Return true if…

Graph Valid Tree

2 min read

Graph Valid Tree

2 min read


Apr 11, 2022

Disjoint sets

This is one important concept for grouping problems. I read all, then started doing the first problem and confused like how to do it. This concept is related to graphs or not graphs but there are a set of nodes or vertices where some vertices are grouped and some or…

Disjoint Sets

3 min read

Disjoint Sets

3 min read


Apr 8, 2022

Binary Tree Cameras

Problem: You are given the root of a binary tree. We install cameras on the tree nodes where each camera at a node can monitor its parent, itself, and its immediate children. Return the minimum number of cameras needed to monitor all nodes of the tree. Never expected such a…

Binary Tree Cameras

2 min read

Binary Tree Cameras

2 min read


Apr 7, 2022

Binary Tree Maximum Path Sum

Another trees related problem :) A path in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. A node can only appear in the sequence at most once. …

Bin Tree Path Sum

2 min read

Bin Tree Path Sum

2 min read

Jyothi

Jyothi

12 Followers

www.linkedin.com/in/jyothivs

Help

Status

Writers

Blog

Careers

Privacy

Terms

About

Text to speech