Created
July 18, 2019 11:20
-
-
Save vsvankhede/5efef29269a7c8068b5c8bad3c2d48b7 to your computer and use it in GitHub Desktop.
This file contains 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 TwoPolitician { | |
public static class Pair { | |
String follower; | |
String following; | |
public Pair(String follower, String following) { | |
this.follower = follower; | |
this.following = following; | |
} | |
} | |
public static void main(String... args) { | |
String M = "Modi"; | |
String O = "Obama"; | |
String A = "Amit Shah"; | |
String T = "Trump"; | |
String R = "Rahul Gandhi"; | |
Pair modiFollower1 = new Pair(O, M); | |
Pair modiFollower2 = new Pair(T, M); | |
Pair modiFollower3 = new Pair(R, M); | |
Pair modiFollower4 = new Pair(A, M); | |
Pair trumpFollower1 = new Pair(M, T); | |
Pair obamaFollower1 = new Pair(M, O); | |
Pair obamaFollower2 = new Pair(T, O); | |
Pair amitFollower1 = new Pair(M, A); | |
List<Pair> pairs = Arrays.asList(modiFollower1, modiFollower2, modiFollower3, modiFollower4, | |
trumpFollower1, | |
obamaFollower1,obamaFollower2, | |
amitFollower1); | |
boolean isFollowing = isFollower(pairs, R, A); | |
if(isFollowing) { | |
System.out.println("Correct following"); | |
} else { | |
System.out.println("Incorrect! not following"); | |
} | |
} | |
public static boolean isFollower(List<Pair> pairs, String polA, String polB) { | |
// write code here | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment