This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.coding; | |
| import java.util.ArrayList; | |
| import java.util.Arrays; | |
| import java.util.List; | |
| /** | |
| * Problem description - https://leetcode.com/discuss/interview-question/1471459/Amazon-OA | |
| */ | |
| public class AmazonInterview2 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.coding; | |
| import java.util.LinkedList; | |
| import java.util.Queue; | |
| /** | |
| * Problem description - https://www.geeksforgeeks.org/shortest-distance-two-cells-matrix-grid/ | |
| */ | |
| public class AmazonInterview1 { | |
| public static void main(String[] args) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class CoinChange { | |
| public static void main(String args[]) | |
| { | |
| int arr[] = {1, 2, 3}; | |
| int m = arr.length; | |
| int n = 4; | |
| System.out.println(count(arr, m, n)); | |
| } | |
| private static int count(int[] arr, int m, int n) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.coding; | |
| public class SubSetSum { | |
| public static void main(String args[]) | |
| { | |
| int set[] = { 3, 34, 4, 12, 5, 2 }; | |
| int sum = 9; | |
| int n = set.length; | |
| System.out.println(isSubsetSum(set, sum, n)); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.coding; | |
| public class MinPointsToReachDest { | |
| public static void main (String args[]) | |
| { | |
| int points[][] = { {-2,-3,3}, | |
| {-5,-10,1}, | |
| {10,30,-5} | |
| }; | |
| int m =3 ,n =3; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.coding; | |
| public class LongestPalindromicSubsequence { | |
| public static void main(String args[]) { | |
| String seq = "GEEKSFORGEEKS"; | |
| int n = seq.length(); | |
| System.out.println("The length of the lps is "+ lps(seq)); | |
| } | |
| private static int lps(String seq) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.coding; | |
| public class LongestCommonSubsequence { | |
| public static void main(String args[]) { | |
| String s1 = "AGGTAB"; | |
| String s2 = "GXTXAYB"; | |
| char[] X=s1.toCharArray(); | |
| char[] Y=s2.toCharArray(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.coding; | |
| public class BooleanMatrix { | |
| public static void main(String [] args) { | |
| int M[][] = { { 0, 0, 1, 1, 0 }, | |
| { 1, 0, 1, 1, 0 }, | |
| { 0, 1, 0, 0, 0 }, | |
| { 0, 0, 0, 0, 1 } }; | |
| int n = 4; | |
| int m = 5; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.coding; | |
| import java.util.LinkedList; | |
| import java.util.Queue; | |
| public class Knight { | |
| public static void main(String [] args) { | |
| int N = 30; | |
| int knightPos[] = { 1, 1 }; | |
| int targetPos[] = { 30, 30 }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.coding; | |
| import java.util.Iterator; | |
| import java.util.LinkedList; | |
| import java.util.Queue; | |
| public class BFS { | |
| public static void main(String[] args) { | |
| Graph g = new Graph(4); |
NewerOlder