Q. Complete the method “changeDateFormat(String paragraph)” which takes a string input containing dates in mm/dd/yyyy format and converts them to “dd/mm/yyyy” format. For example, “My birthday is on 04/25/1980” becomes “My birthday is on 25/04/1980”
Q. Complete the method “changeDateFormat(String paragraph)” which takes a string input containing dates in mm/dd/yyyy format and converts them to “dd/mm/yyyy” format. For example, “My birthday is on 04/25/1980” becomes “My birthday is on 25/04/1980”
Q. Complete the method “canAttendAll(Collection seminars)” which takes a collection of seminar objects with start and end timestamps, and the method should determine if there is an overlap in seminars…
Login Register 100+ Free Java interview FAQs 100+ Free Big Data interview FAQs
Q. Complete the method “isValidBST(Node root)” which takes a “Tree node” as an input to evaluate if the input is a valid BST (i.e. Binary Search Tree)?
Q. Complete the “areAnagrams(String a, String b)” method so that it returns if two given input strings are anagram or not?
1 2 3 4 5 6 7 8 9 10 11 12 |
public class InputAreAnagrams { public static boolean areAnagrams(String a, String b) { throw new RuntimeException("Not yet implemented...." |
Q. Complete the method “isPalindrome(String str) ” which takes a “string” as an input to evaluate if the input is a palindrome?
1 2 3 4 5 6 7 8 9 10 11 12 |
public class Palindrome { public static boolean isPalindrome(String str) { throw new RuntimeException("To be completed"); } public static void main(String[] args) { System. |
Q. Complete the method ” public DirPath cd(String newPath)” which applies the following rules: / : starting with “/” means root directory, else next directory path. ../ : means go…
Login Register 100+ Free Java interview FAQs 100+ Free Big Data interview FAQs
Q. Complete the method “int startIndexOfLongestRun(String input)” that returns the start index of a character that has the longest consecutive count.
1 2 3 4 5 6 7 8 9 10 11 12 |
public class MaxConsecutiveChar { public static int startIndexOfLongestRun(String input) { throw new RuntimeException("To be completed"); } public static void main(String[] args) { System. |
Q. Complete the method “int numberOfWays(int n)” where n is the distance to cover and the method should return the number of possible combinations if a frog can jump 1…
Login Register 100+ Free Java interview FAQs 100+ Free Big Data interview FAQs
Q. Complete the method “Set getAllCombinations(String input) ” where input is any string and the method should return all possible combinations of a given string.
Q. Complete the method “Set getAllCombinations(String input) ” where input is any string and the method should return all possible combinations of a given string.