Arnab Chakraborty has Published 4293 Articles

Cheapest Flights Within K Stops in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Nov-2020 11:05:59

679 Views

Suppose we have n cities connected by m flights. Each flight starts from u and arrives at v with a price w. If we have all the cities and flights, together with starting city src and the destination dst, here our task is to find the cheapest price from src ... Read More

Redundant Connection in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Nov-2020 11:03:03

412 Views

Suppose we have one unrooted tree; this is one undirected graph with no cycles. The given input is a graph that started as a tree with N nodes (values of the nodes are distinct values ranging from 1 through N), with one additional edge added. The added edge has two ... Read More

Restore IP Addresses in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Nov-2020 10:55:26

458 Views

Suppose we have a string containing only digits, we have to restore it by returning all possible valid IP address combinations. We know that a valid IP address consists of exactly four integers (each integer is in range 0 to 255) separated by single points.So, if the input is like ... Read More

Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Nov-2020 10:49:21

227 Views

Suppose we have a binary tree where each path going from the root to any leaf form a valid sequence, we have to check whether a given string is a valid sequence in such binary tree or not.We will get the given string from the concatenation of an array of ... Read More

First Unique Number in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Nov-2020 10:45:29

603 Views

Suppose we have a queue of integers, we need to retrieve the first unique integer in that queue. We have to implement the class called FirstUnique: It will be initialized by the numbers in the queue. Define one function showFirstUnique(), this will return the value of the first unique integer ... Read More

Sentence Similarity II in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Nov-2020 10:43:12

565 Views

Suppose we have Given two arrays words1, words2 these are considered as sentences, and a list of similar word pairs, we have to check whether two sentences are similar or not. So if the input is like words1 = ["great", "acting", "skills"] and words2 = ["fine", "drama", "talent"] these two ... Read More

Insert into a Sorted Circular Linked List in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Nov-2020 10:40:07

393 Views

Suppose we have a node from a Circular Linked List which is sorted in increasing order, we have to define a function to insert a value insertVal into the list such that it remains a sorted circular list.The node can be a reference to any single node in the list, ... Read More

Search in a Sorted Array of Unknown Size in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Nov-2020 10:36:59

372 Views

Suppose we have an array and that is sorted in ascending order, we have to define a function to search target in nums. If the target is present, then return its index, otherwise, return -1.The array size is not known. We can only access the array using an ArrayReader interface. ... Read More

Number of Distinct Islands in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 17-Nov-2020 10:35:04

278 Views

Suppose we have a binary 2D array grid, here an island is a group of 1's (land) connected 4- directionally (horizontal or vertical.) We can assume all four edges of the grid are surrounded by water. We have to count the number of distinct islands.An island is considered to be ... Read More

Next Closest Time in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 16-Nov-2020 14:44:10

359 Views

Suppose we have a time represented in the format "HH: MM", we have to generate the next closest time by reusing the current digits. We can use the digit an unlimited number of times.So, if the input is like "19:34", then the output will be "19:39" as the next closest ... Read More

Advertisements