Skip to content
TutorialCup
  • Home
  • Tutorials
    • C
    • C++
    • DBMS
    • Java
    • Python
    • SQL
    • Testing
    • GitHub
    • Spring Boot
    • R
    • JavaScript
  • Interviews
    • Technical Interview Questions
    • Interview Questions

TutorialCup

  • Home
  • Tutorials
    • C
    • C++
    • DBMS
    • Java
    • Python
    • SQL
    • Testing
    • GitHub
    • Spring Boot
    • R
    • JavaScript
  • Interviews
    • Technical Interview Questions
    • Interview Questions

Find the Town Judge Leetcode Solution

Problem Statement In this problem, we are given n people labelled from 1 to n. We are also given a 2d array trust[][] shows that trust[i][0]th people trusts trust[i][1]th people for each 0 <= i < trust.length. We have to find a person “town judge” who does not trust any …

Read more

Categories LeetCode Solutions Tags Amazon, Easy, Graph

Course Schedule II – LeetCode

You have to attend n number of courses (from 0 to n-1) where some of the courses have prerequisites. For instance: pair [2, 1] represents to attend course 2 you must have taken course 1. Given an integer n representing the total number of courses and the list of courses …

Read more

Categories LeetCode Solutions Tags Breadth First Search, Depth First Search, Graph, Medium, Topological Sort

Find the smallest binary digit multiple of given number

Problem Statement The problem “Find the smallest binary digit multiple of given number” states that you are given a decimal number N. So find the smallest multiple of N that contains only the binary digits ‘0’ and ‘1’. Example 37 111 A detailed explanation can be found below in the …

Read more

Categories Graph Interview Questions Tags Amazon, Breadth First Search, Fourkites, Graph, LinkedIn, Medium, Microsoft, Snapdeal

Minimum Operations to convert X to Y

Problem Statement The problem “Minimum Operations to convert X to Y” states that you are given two numbers X and Y, it is needed to convert X into Y using following operations: Starting number is X. Following operations can be performed on X and on the numbers that are generated …

Read more

Categories Graph Interview Questions Tags Amazon, Breadth First Search, Factset, Fanatics, Fourkites, Graph, JP Morgan, Medium, Myntra, Samsung, Spotify, Square

Check if two nodes are on the same path in a Tree

Problem Statement The problem “Check if two nodes are on the same path in a Tree” states that you are given a n-ary tree (directed acyclic graph) rooted at root node with uni-directional edges between it’s vertices. You are also given a list of queries q. Each query in list …

Read more

Categories Graph Interview Questions Tags Amazon, Depth First Search, Factset, Fourkites, Graph, Graph Traversal, Medium, Samsung

Distance of nearest cell having 1 in a binary matrix

Problem Statement The problem “Distance of nearest cell having 1 in a binary matrix” states that you are given a binary matrix(containing only 0s and 1s) with at least one 1. Find the distance of the nearest cell having 1 in the binary matrix for all the elements of the …

Read more

Categories Queue Interview Questions Tags Accenture, Amazon, Array, Breadth First Search, Graph, Hard, Honeywell, HSBC, Hulu, Matrix, Queue, Twitter

Transpose Graph

Problem Statement The problem “Transpose graph” states that you are given a graph and you need to find the transpose of the given graph. Transpose: Transpose of a directed graph produces another graph with same edge & node configurations but the direction of all the edges have been reversed. Example …

Read more

Categories Graph Interview Questions Tags Accenture, Amazon, Basic, Cyptography, Graph, JP Morgan, Microsoft, Zycus

Count the number of nodes at given level in a tree using BFS

Description The problem “Count the number of nodes at given level in a tree using BFS” states that you are given a Tree (acyclic graph) and a root node, find out number of nodes at L-th level. Acyclic Graph: It is a network of nodes connected through edges which has …

Read more

Categories Tree Interview Questions Tags Alation, BankBazaar, Breadth First Search, Easy, Graph, JP Morgan, Square, Taxi4Sure, Tree, Tree Traversal

BFS for Disconnected Graph

Problem Statement The problem “BFS for Disconnected Graph” states that you are given a disconnected directed graph, print the BFS traversal of the graph. Example The BFS traversal of the graph above gives: 0 1 2 5 3 4 6 Approach Breadth first Search (BFS) traversal for Disconnected Directed Graph …

Read more

Categories Graph Interview Questions Tags Amazon, Breadth First Search, Easy, Graph, Graph Traversal, Hulu, Karat, Microsoft, Salesforce

Minimum Steps to reach target by a Knight

Description The problem “Minimum Steps to reach target by a Knight” states that you are given a square chess board of N x N dimensions, co-ordinates of the Knight piece, and the target cell. Find out the minimum number of steps taken by the Knight piece to reach the target …

Read more

Categories Graph Interview Questions Tags Amazon, Breadth First Search, Dynamic Programming, Graph, Hard, LinkedIn, MakeMyTrip, Queue
Post navigation
Older posts
1 2 3 Next →

Search




© TutorialCup 2021 | Feeds | Privacy Policy | Terms | Contact Us | Linkedin | About Us
Scroll back to top
Next Page »