Arnab Chakraborty has Published 4293 Articles

Program to find H-Index from a list of citations in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Nov-2020 06:17:15

349 Views

Suppose we have an array of citations of a researcher. We have to define a function to compute the researcher's h-index. As we know the h-index is a metric used to calculate the impact of a researcher's papers. Formally H-index can be defined as: "A researcher has index h if ... Read More

Program to find number of friend groups in a set of friends connections in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Nov-2020 06:15:35

790 Views

Suppose we have a a friends list, where friends[i] is a list of people i is friends with. The connection of friendships are two-way. And each person is friend with themselves and two people are in a friend group as long as there is some path of mutual friends connecting ... Read More

Program to find maximum sum by flipping each row elements in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 19-Nov-2020 06:13:02

278 Views

Suppose we have a 2D binary matrix. For any row or column in the given matrix we can flip all the bits. If we can perform any number of these operations, and that we treat each row as a binary number, we have to find the largest sum that can ... Read More

Android Unlock Patterns in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Nov-2020 12:21:48

1K+ Views

Suppose we have an Android 3x3 key lock screen and two integers m and n, the values of m and n are in range 1 ≤ m ≤ n ≤ 9, We have to count the total number of unlock patterns of the Android lock screen, which consist of minimum ... Read More

Largest BST Subtree in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Nov-2020 12:19:14

157 Views

Suppose we have a binary tree; we have to find the largest subtree of it where largest means subtree with largest number of nodes in it.So, if the input is like, then the output will be 3, as the Largest BST Subtree, in this case, is the highlighted one.To solve ... Read More

Maximum Size Subarray Sum Equals k in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Nov-2020 12:15:47

793 Views

Suppose we have an array called nums and a target value k, we have to find the maximum length of a subarray that sums to k. If there is not present any, return 0 instead.So, if the input is like nums = [1, -1, 5, -2, 3], k = 3, ... Read More

Number of Connected Components in an Undirected Graph in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Nov-2020 12:13:59

2K+ Views

Suppose we have n nodes and they are labeled from 0 to n - 1 and a list of undirected edges, are also given, we have to define one function to find the number of connected components in an undirected graph.So, if the input is like n = 5 and ... Read More

Generalized Abbreviation in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Nov-2020 12:11:31

268 Views

Suppose there is a word. We have to define a function that can generate the generalized abbreviations of a word.So, if the input is like "word", then the output will be ["word", "1ord", "w1rd", "wo1d", "wor1", "2rd", "w2d", "wo2", "1o1d", "1or1", "w1r1", "1o2", "2r1", "3d", "w3", "4"]To solve this, we ... Read More

Binary Tree Vertical Order Traversal in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Nov-2020 12:08:23

396 Views

Suppose there is a binary tree, we have to find the vertical order traversal of its nodes' values. If two nodes are in the same row and column, the order should be from left to right.So, if the input is like, then the output will be [[9], [3, 15], [20], ... Read More

Sparse Matrix Multiplication in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Nov-2020 12:03:42

3K+ Views

Suppose we have two matrices A and B, we have to find the result of AB. We may assume that A's column number is equal to B's row number.So, if the input is like [[1, 0, 0], [-1, 0, 3]] [[7, 0, 0], [0, 0, 0], [0, 0, 1]], 100-103700000001then ... Read More

Advertisements