master b2dd6d74c029 cached
28 files
41.3 KB
12.5k tokens
91 symbols
1 requests
Download .txt
Repository: Java-aid/Interview-Preparations
Branch: master
Commit: b2dd6d74c029
Files: 28
Total size: 41.3 KB

Directory structure:
gitextract_lfieso94/

├── InterviewsPreparation/
│   ├── .classpath
│   ├── .gitignore
│   ├── .project
│   ├── .settings/
│   │   ├── org.eclipse.core.resources.prefs
│   │   ├── org.eclipse.jdt.core.prefs
│   │   └── org.eclipse.m2e.core.prefs
│   ├── pom.xml
│   └── src/
│       └── main/
│           └── java/
│               └── com/
│                   └── javaaid/
│                       └── ip/
│                           ├── app_dynamics/
│                           │   ├── AnagramDifference.java
│                           │   ├── MeetingScheduler.java
│                           │   ├── Solution1.java
│                           │   ├── UniqueWordFinder.java
│                           │   └── copy/
│                           │       └── Solution1.java
│                           ├── ca/
│                           │   └── TheLightStore.java
│                           ├── cleartrip/
│                           │   └── StringChain.java
│                           ├── goldman_sachs/
│                           │   ├── MNStringSolution.java
│                           │   ├── NonRepeatingDigitInProduct.java
│                           │   └── NumberChecker.java
│                           ├── lenskart/
│                           │   └── StringGame.java
│                           ├── microsoft/
│                           │   └── CalculateCombinations.java
│                           ├── spraoi/
│                           │   ├── CoinChange.java
│                           │   └── IntegerToRomanNumberConversion.java
│                           ├── temnos/
│                           │   └── RajuMarriage.java
│                           └── wissen_infotech/
│                               ├── SpecialArrayConversion.java
│                               └── Stats.java
├── ProblemStatements/
│   ├── Cleartrip/
│   │   └── cleartrip_hackerrank_test.docx
│   └── Sproai/
│       ├── spraoi_Q1.docx
│       └── spraoi_Q2.docx
└── README.md

================================================
FILE CONTENTS
================================================

================================================
FILE: InterviewsPreparation/.classpath
================================================
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
	<classpathentry kind="src" output="target/test-classes" path="src/test/java">
		<attributes>
			<attribute name="optional" value="true"/>
			<attribute name="maven.pomderived" value="true"/>
		</attributes>
	</classpathentry>
	<classpathentry kind="src" output="target/classes" path="src/main/java">
		<attributes>
			<attribute name="optional" value="true"/>
			<attribute name="maven.pomderived" value="true"/>
		</attributes>
	</classpathentry>
	<classpathentry kind="src" path="src/main/resources"/>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
		<attributes>
			<attribute name="maven.pomderived" value="true"/>
		</attributes>
	</classpathentry>
	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
		<attributes>
			<attribute name="maven.pomderived" value="true"/>
		</attributes>
	</classpathentry>
	<classpathentry kind="output" path="target/classes"/>
</classpath>


================================================
FILE: InterviewsPreparation/.gitignore
================================================
/target/


================================================
FILE: InterviewsPreparation/.project
================================================
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
	<name>Interviews-Preparation</name>
	<comment></comment>
	<projects>
	</projects>
	<buildSpec>
		<buildCommand>
			<name>org.eclipse.jdt.core.javabuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.m2e.core.maven2Builder</name>
			<arguments>
			</arguments>
		</buildCommand>
	</buildSpec>
	<natures>
		<nature>org.eclipse.jdt.core.javanature</nature>
		<nature>org.eclipse.m2e.core.maven2Nature</nature>
	</natures>
</projectDescription>


================================================
FILE: InterviewsPreparation/.settings/org.eclipse.core.resources.prefs
================================================
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/test/java=UTF-8
encoding/<project>=UTF-8


================================================
FILE: InterviewsPreparation/.settings/org.eclipse.jdt.core.prefs
================================================
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.8


================================================
FILE: InterviewsPreparation/.settings/org.eclipse.m2e.core.prefs
================================================
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1


================================================
FILE: InterviewsPreparation/pom.xml
================================================
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.javaaid.interviews.preparation</groupId>
  <artifactId>InterviewsPreparation</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>InterviewsPreparation</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>


================================================
FILE: InterviewsPreparation/src/main/java/com/javaaid/ip/app_dynamics/AnagramDifference.java
================================================
/**
 * 
 */
package com.javaaid.ip.app_dynamics;

import java.util.Scanner;

/**
 * @author Kanahaiya Gupta
 *
 */
public class AnagramDifference {
	
			public static void main(String[] args) {
				AnagramDifference s=new AnagramDifference();
				Scanner in = new Scanner(System.in);
				String[] a = {"a","jk","abb","mn","abc"} ;
				String[] b = {"bb","kj","bbc","op","def"};
					 s.getMinimumDifference(a,b);
				}
			
			private  int[] getMinimumDifference(String[] a, String[] b) {
				int n=a.length;
				int ans[]=new int[n];
				for(int i=0;i<n;i++) {
					String s1=a[i];
					String s2=b[i];
					int result=getAnagramDiff(s1,s2);
					ans[i]=result;
//				System.out.println(result);
			}
				return ans;
			}
	  int getAnagramDiff(String s1, String s2)
		    {
		        int count = 0;
		        int s1len=s1.length();
		        int s2len=s2.length();
		        if(s1len!=s2len)return-1;
		        int char_count[] = new int[26];
		 
		        for (int i = 0; i < s1.length(); i++) 
		            char_count[s1.charAt(i) - 'a']++;        
		        for (int i = 0; i < s2.length(); i++) 
		            if (char_count[s2.charAt(i) - 'a']-- <= 0)
		                count++;
		         
		        return count;
		    }
	 }

================================================
FILE: InterviewsPreparation/src/main/java/com/javaaid/ip/app_dynamics/MeetingScheduler.java
================================================
/**
 * Problem Statement-
 * ------------------------------
 * There are lot of meeting which has been schedule for today and schedule of meetings has been provide based on that you need to arrange minimum rooms so that nobody has to wait for meeting room as cost of meeting room is also high, so arrange less meeting room for all the meetings.
	
	input--> (startTime,endTime)
	(1,4),(2,8),(3,6)
	output- 3
	
	input--> (1,5),(2,6),(6,8),(7,9)
	output-> 2
 */
package com.javaaid.ip.app_dynamics;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Scanner;

/**
 * 
 * @author Kanahaiya Gupta
 *
 */
class Time {
	private int inTime;
	private int outTime;

	public Time(int inTime, int outTime) {
		super();
		this.inTime = inTime;
		this.outTime = outTime;
	}

	public int getInTime() {
		return inTime;
	}

	public void setInTime(int inTime) {
		this.inTime = inTime;
	}

	public int getOutTime() {
		return outTime;
	}

	public void setOutTime(int outTime) {
		this.outTime = outTime;
	}

}

public class MeetingScheduler {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int T = sc.nextInt();
		List<Time> lists = new ArrayList<Time>();
		while (T-- > 0) {
			int n = sc.nextInt();
			for (int i = 0; i < n; i++) {
				int in = sc.nextInt();
				int out = sc.nextInt();
				Time slot = new Time(in, out);
				lists.add(slot);
			}
			int minRoomCount = getMinRoomCount(lists);
			System.out.println(minRoomCount);
		}

	}

	private static int getMinRoomCount(List<Time> lists) {
		int a[] = new int[25];
		HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
		for (Time t : lists) {
			map.put(t.getOutTime(), -1);
		}
		for (Time interval : lists) {
			fillArray(interval, map, a);
		}
		int max = getMax(a);
		return max;
	}

	private static int getMax(int[] a) {
		int max = Integer.MIN_VALUE;
		for (int i = 0; i < a.length; i++) {
			max = Math.max(max, a[i]);
		}
		return max;
	}

	private static void fillArray(Time interval, HashMap<Integer, Integer> map, int[] a) {
		int start = interval.getInTime();
		int end = interval.getOutTime();
		int i = 0;
		if (map.containsKey(start)) {
			i = start+1;
		} else {
			i = start;
		}
		for (; i <= end; i++) {
			a[i]++;
		}
	}

}


================================================
FILE: InterviewsPreparation/src/main/java/com/javaaid/ip/app_dynamics/Solution1.java
================================================
/**
 * 
 */
package com.javaaid.ip.app_dynamics;

import java.util.Scanner;

/**
 * @author Kanahaiya Gupta
 *
 */
public class Solution1 {
	public static int maxProfit(int[] a) {
		int max_so_far = 0, curr_max = 0;
		for (int i = 1; i < a.length; i++) {
			curr_max += a[i] - a[i - 1];
			curr_max = Math.max(curr_max, 0);
			max_so_far = Math.max(max_so_far, curr_max);
		}
		return max_so_far <= 0 ? -1 : max_so_far;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a[] = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		int result = maxProfit(a);
		System.out.println(result);
	}

}


================================================
FILE: InterviewsPreparation/src/main/java/com/javaaid/ip/app_dynamics/UniqueWordFinder.java
================================================
/**
 *Problem Statement-
 *------------------------------
 *There is a file containing plain text, you need to tell whether all the unique words in whole file is present in single line or not?
	Ex- 
	input->
	a
	a b
	b c d
	a b c d
	
	output->yes
	
	input->
	a
	a b
	b c d
	a b c d
	e
	
	output->no
	Note: treat character as words for ease
 
 */

package com.javaaid.ip.app_dynamics;

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 * 
 * @author Kanahaiya Gupta
 *
 */
public class UniqueWordFinder {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int T = sc.nextInt();
		while (T-- > 0) {
			int lineCount = sc.nextInt();
			sc.nextLine();
			String[] lines = new String[lineCount];
			for (int i = 0; i < lineCount; i++) {
				lines[i] = sc.nextLine();
			}
			boolean result = getUniqChar(lines);
			System.out.println(result ? "YES" : "NO");
		}
		sc.close();
	}

	private static boolean getUniqChar(String[] lines) {
		Set<String> gWords = new HashSet<String>();
		int globalSize = 0, localMax = 0;
		for (String line : lines) {
			Set<String> lWords = new HashSet<String>();
			String words[] = line.split(" ");
			for (String word : words) {
				lWords.add(word);
			}
			localMax = Math.max(localMax, lWords.size());
			gWords.addAll(lWords);
			globalSize = Math.max(globalSize, gWords.size());
		}
		return (globalSize == localMax);
	}

}


================================================
FILE: InterviewsPreparation/src/main/java/com/javaaid/ip/app_dynamics/copy/Solution1.java
================================================
/**
 * 
 */
package com.javaaid.ip.app_dynamics.copy;

import java.util.Scanner;

/**
 * @author Kanahaiya Gupta
 *
 */
public class Solution1 {
	public static int maxProfit(int[] a) {
		int max_so_far = 0, curr_max = 0;
		for (int i = 1; i < a.length; i++) {
			curr_max += a[i] - a[i - 1];
			curr_max = Math.max(curr_max, 0);
			max_so_far = Math.max(max_so_far, curr_max);
		}
		return max_so_far <= 0 ? -1 : max_so_far;
	}

	int maxDiff(int a[]) {
		if (a == null || a.length < 2)
			return -1;
		int maxDiff = a[1] - a[0];
		int len = a.length;
		int min = a[0];
		for (int i = 1; i < len; i++) {
			if (a[i] - min > maxDiff)
				maxDiff = a[i] - min;

			if (a[i] < min)
				min = a[i];
		}

		return maxDiff <= 0 ? -1 : maxDiff;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a[] = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		int result = maxProfit(a);
		System.out.println(result);
	}

}


================================================
FILE: InterviewsPreparation/src/main/java/com/javaaid/ip/ca/TheLightStore.java
================================================
/**
 * 
 */
package com.javaaid.ip.ca;

import java.util.Scanner;

/**
 * @author Kanahaiya Gupta
 *
 */
public class TheLightStore {

	private static int getOpCount(String str1, String str2) {
		int dp[][] = new int[str1.length() + 1][str2.length() + 1];
		for (int i = 0; i <= str1.length(); i++) {
			for (int j = 0; j <= str2.length(); j++) {
				if (i == 0)
					dp[i][j] = j;
				else if (j == 0)
					dp[i][j] = i;
				else if (str1.charAt(i - 1) == str2.charAt(j - 1))
					dp[i][j] = dp[i - 1][j - 1];
				else {
					dp[i][j] = 1 + Math.min(dp[i - 1][j], Math.min(dp[i][j - 1], dp[i - 1][j - 1]));
				}
			}
		}
		return dp[str1.length()][str2.length()];
	}

	public static void main(String args[]) throws Exception {
		Scanner sc = new Scanner(System.in);
		String input = sc.next();
		String output = sc.next();
		int result = getOpCount(input, output);
		System.out.println(result);
	}
}


================================================
FILE: InterviewsPreparation/src/main/java/com/javaaid/ip/cleartrip/StringChain.java
================================================
/**
 * 
 */
package com.javaaid.ip.cleartrip;

import java.util.Scanner;

/**
 * @author Kanahaiya Gupta
 *
 */
public class StringChain {

	static int charCount = 0;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		/*int N = sc.nextInt();
		String words[] = new String[N];
		for (int i = 0; i < N; i++) {
			words[i] = sc.next();
		}*/
        String[] words = new String[]{"a", "b","ba", "bca", "bda", "bdca"};

		int result = calulateLongestChain(words);
		System.out.println(result);
		sc.close();
	}

	/**
	 * @param words
	 * @return
	 */
	private static int calulateLongestChain(String[] words) {
		int maxLongestChainOfCharacter = 0;
		for (String word : words) {
			int currentCharCount= findMaxChain(words, word, 0);
			maxLongestChainOfCharacter = Math.max(maxLongestChainOfCharacter, currentCharCount);

		}
		return maxLongestChainOfCharacter;
	}

	/**
	 * @param word
	 * @return
	 */
	private static int findMaxChain(String[] words, String word, int lenCounter) {
		if (!wordsContains(words, word)) {
			return 0;
		}
		lenCounter++;
		charCount = lenCounter;
		for (int i = 0; i < word.length(); i++) {
			StringBuilder sb = new StringBuilder(word);
			sb.delete(i, i + 1);
			findMaxChain(words, sb.toString(), lenCounter);
		}
		return charCount;
	}

	/**
	 * @param string
	 * @return
	 */
	private static boolean wordsContains(String[] words, String string) {
		for (String word : words) {
			if (word.equals(string)) {
				return true;
			}
		}
		return false;
	}

}


================================================
FILE: InterviewsPreparation/src/main/java/com/javaaid/ip/goldman_sachs/MNStringSolution.java
================================================
/**
 * problem statement-
 * ------------------------------------
 * Question:
	Given a Pattern containing only Ns and M’s . N represents ascending and M represents descending , Each character (M or
	N) needs to display sequence of numbers(2 numbers) explaining the ascending or descending order (for ex: 21 -
	>represents descending -> M) . The second character in the pattern takes the last digit from first character and builds the
	sequence and so on..Please look at example section below.
	There could be multiple numbers satisfying the pattern. The goal is to find out the lowest numeric value following the
	pattern.
	Constraints:
	Input can have maximum 8 characters
	Output can have Digits from 1-9 and Digits can’t repeat.
	In case of no possible output or incorrect input value (like blank /null /NON M or N character) please return -1.
	Example Section:
	Input : M
	Output: 21 (2 -> 1 shows descending and possible smallest numeric value. Even 65 or 74 can qualify, but 21 being the
	smallest numeric value is the correct answer)
	Input : MNM
	Output:2143 (M represents descending 2->1 , N represents ascending 1->4 (1 is coming from last character) , M
	represents descending 4->3(4 is coming from last character sequence) -- There would be many number qualifying the
	pattern like 3142 ,8796,6241 etc.. 2143 is the lowest numeric value for this pattern sequence.)
 */

package com.javaaid.ip.goldman_sachs;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.PriorityQueue;
import java.util.Scanner;

/**
 * @author Kanahaiya Gupta
 *
 */
public class MNStringSolution {
	static PriorityQueue<Integer> heap = new PriorityQueue<Integer>();;

	/*
	 * Complete the function below.
	 */
	static int findPossibleSmallestNumberMatchingPattern(String pattern) {
		if (validatePattern(pattern))
			return -1;
		return Integer.parseInt(processString(pattern));

	}

	/**
	 * @param pattern
	 * @return
	 */
	private static boolean validatePattern(String pattern) {
		return (pattern.equals("") || pattern == "" || pattern == " " || pattern == null
				|| getMNCount(pattern) != pattern.length());
	}

	/**
	 * @param c
	 * @return
	 */
	private static int getMNCount(String pattern) {
		int mCount = 0, nCount = 0;
		for (int i = 0; i < pattern.length(); i++) {
			if (pattern.charAt(i) == 'M') {
				mCount++;
			}
			if (pattern.charAt(i) == 'N') {
				nCount++;
			}
		}
		return nCount + mCount;
	}

	public static void main(String[] args) throws IOException {
		Scanner in = new Scanner(System.in);
		final String fileName = System.getenv("OUTPUT_PATH");
		BufferedWriter bw = null;
		if (fileName != null) {
			bw = new BufferedWriter(new FileWriter(fileName));
		} else {
			bw = new BufferedWriter(new OutputStreamWriter(System.out));
		}

		int res;
		String pattern;
		try {
			pattern = in.nextLine();
		} catch (Exception e) {
			pattern = null;
		}

		res = findPossibleSmallestNumberMatchingPattern(pattern);
		bw.write(String.valueOf(res));
		bw.newLine();

		bw.close();
	}

	/**
	 * @param input
	 * @return
	 */
	private static String processString(String input) {
		String res = "";
		int len = input.length();
		for (int k = 1; k <= len + 1; k++)
			heap.add(k);
		int mCount = 0;
		int nCount = 0;
		for (int i = 0; i < len; i++) {
			if (input.charAt(i) == 'M') {
				mCount = getConsecutiveCount(input, i, 'M');
				res += getElement(mCount + 1);
				mCount = 0;
			} else {
				res += getElement(1);
				nCount = 0;
			}

		}
		return res + heap.poll();
	}

	public static int getConsecutiveCount(String input, int index, char ch) {
		int c = 0;
		for (int i = index; i < input.length(); i++) {
			if (input.charAt(i) == ch) {
				c++;
			} else {
				break;
			}
		}
		return c;

	}

	private static String getElement(int k) {
		PriorityQueue<Integer> pq = new PriorityQueue<Integer>();
		int tmp = 0, c = 0;

		while (k-- > 0) {
			tmp = heap.poll();
			c++;
			if (k > 0) {
				pq.add(tmp);
			} else {
				break;
			}
		}
		heap.addAll(pq);
		return tmp + "";
	}

}


================================================
FILE: InterviewsPreparation/src/main/java/com/javaaid/ip/goldman_sachs/NonRepeatingDigitInProduct.java
================================================
/**
problem statement-
--------------------------------
Given a number 'x', and a range of ‘y’ to ‘z’, please find the count of all the numbers ‘n’ in that range, such that the product of the number ‘n’ and 'x' does not contain any digit from the number ‘n’.
General Constraints: All the inputs will be integers and below 10
E.g., if x = 2, y = 10 and z = 15, then,
2 x 10 = 20 // Invalid, since the product contains 0 from 10.
2 x 11 = 22 // Valid
2 x 12 = 24 // Invalid, since the product contains 2 from 12.
2 x 13 = 26 // Valid
2 x 14 = 28 // Valid
2 x 15 = 30 // Valid
Hence, the final count is 4.
Example Input:
2
10
15
Example Output:
4
 * 
 */
package com.javaaid.ip.goldman_sachs;

import java.util.HashSet;
import java.util.Set;

/**
 * @author Kanahaiya Gupta
 *
 */
public class NonRepeatingDigitInProduct {

	public static void main(String[] args) {
		System.out.println(nonRepeatingDigitProductCount(0, 1111, 999999));
	}
	// Complete the
	// nonRepeatingDigitProductCount function below.*/

	static int nonRepeatingDigitProductCount(int x, int y, int z) {
		Set<Character> set1 = new HashSet<Character>();
		Set<Character> set2 = new HashSet<Character>();
		if (y > z || x == 1)
			return 0;

		int countInValid = 0;
		for (int i = y; i <= z; i++) {

			long product = i * x;

			for (char ch : (i + "").toCharArray())
				set1.add(ch);

			for (char ch : (product + "").toCharArray())
				set2.add(ch);

			int set2Size = set2.size();
			set2.addAll(set1);
			if (set1.size() + set2Size > set2.size()) {
				countInValid++;
			}
			set1.clear();
			set2.clear();
		}
		return (z - y) - countInValid + 1;
	}

}


================================================
FILE: InterviewsPreparation/src/main/java/com/javaaid/ip/goldman_sachs/NumberChecker.java
================================================
/**
*problem statement-
	---------------------------------
	Given an integer array as input, find out the integers which contains the digits 1,2,3 numbers in its formation . The order of 1,2,3 need
	not be sequential.
	In case multiple numbers qualifies the condition, The outcome should be ordered based on numeric value (lesser number first followed
	by greater number and so on..) and separated by comma.
	In case no number qualifies the conditions, it should return -1.
	Example:
	Input :
	1456
	345671
	43218
	123
	Output: 123,43218
	Explanation: In the above example, as there are 2 numbers(43218,123) which qualifies the condition, we need to sort the output in
	ascending order seperated by comma.
 * 
 */
package com.javaaid.ip.goldman_sachs;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * @author Kanahaiya Gupta
 *
 */
public class NumberChecker {
	static String findQualifiedNumbers(int[] numberArray) {
		Arrays.sort(numberArray);
		String num = "", res = "";
		for (int i : numberArray) {
			num = i + "";
			if (num.indexOf("1") != -1 && num.indexOf("2") != -1 && num.indexOf("3") != -1) {
				res += i + ",";
			}
		}
		return res.equals("") ? "-1" : res.substring(0, res.length() - 1);
	}

	public static void main(String[] args) throws IOException {
		Scanner in = new Scanner(System.in);
		final String fileName = System.getenv("OUTPUT_PATH");
		BufferedWriter bw = null;
		if (fileName != null) {
			bw = new BufferedWriter(new FileWriter(fileName));
		} else {
			bw = new BufferedWriter(new OutputStreamWriter(System.out));
		}

		String res;
		int numberArray_size = 0;
		numberArray_size = Integer.parseInt(in.nextLine().trim());

		int[] numberArray = new int[numberArray_size];
		for (int i = 0; i < numberArray_size; i++) {
			int numberArray_item;
			numberArray_item = Integer.parseInt(in.nextLine().trim());
			numberArray[i] = numberArray_item;
		}

		res = findQualifiedNumbers(numberArray);
		bw.write(res);
		bw.newLine();

		bw.close();
	}
}


================================================
FILE: InterviewsPreparation/src/main/java/com/javaaid/ip/lenskart/StringGame.java
================================================
/**
 * 
 */
package com.javaaid.ip.lenskart;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

/**
 * @author Kanahaiya Gupta
 *
 */
public class StringGame {
	InputStream is;
	PrintWriter out;
	String INPUT = "";

	void solve() {
		for (int T = ni(); T > 0; T--) {
			String in = ns();
			int result = getWinner(in);
			System.out.println(result == 1 ? "Player1" : "Player2");
		}

	}

	/**
	 * @param in
	 * @return
	 */
	private static int getWinner(String in) {
		int a[]=new int[26];
		for(int i=0;i<in.length();i++) {
			int index=in.charAt(i)-'a';
			a[index]++;
		}
		int c=0;
		for(int i=0;i<26;i++) {
			if(a[i]!=0)
			c++;
		}
		
		return (c&1)==1?1:2;
	}

	void run() throws Exception {
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if (!INPUT.isEmpty())
			tr(System.currentTimeMillis() - s + "ms");
	}

	public static void main(String[] args) throws Exception {
		new StringGame().run();
	}

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte() {
		if (lenbuf == -1)
			throw new InputMismatchException();
		if (ptrbuf >= lenbuf) {
			ptrbuf = 0;
			try {
				lenbuf = is.read(inbuf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (lenbuf <= 0)
				return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) {
		return !(c >= 33 && c <= 126);
	}

	private int skip() {
		int b;
		while ((b = readByte()) != -1 && isSpaceChar(b))
			;
		return b;
	}

	private double nd() {
		return Double.parseDouble(ns());
	}

	private char nc() {
		return (char) skip();
	}

	private String ns() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n) {
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while (p < n && !(isSpaceChar(b))) {
			buf[p++] = (char) b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m) {
		char[][] map = new char[n][];
		for (int i = 0; i < n; i++)
			map[i] = ns(m);
		return map;
	}

	private int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private int ni() {
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl() {
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private static void tr(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
}


================================================
FILE: InterviewsPreparation/src/main/java/com/javaaid/ip/microsoft/CalculateCombinations.java
================================================
/**
Microsoft coding test for SDET
calculate Nck for given n & k
 * 
 */
package com.javaaid.ip.microsoft;

/**
 * @author Kanahaiya Gupta
 *
 */
public class CalculateCombinations {

	static long calculateCombinations(int n, int k) {
		int cache[] = new int[k + 1];
		cache[0] = 1;

		for (int i = 1; i <= n; i++) {
			int tmp=Math.min(i, k);
			for (int j = tmp; j > 0; j--)
				cache[j] = cache[j] + cache[j - 1];
		}
		return cache[k];
	}

	/* Driver program to test above function */
	public static void main(String[] args) {
		int n = 100, k = 2;
		System.out.printf("Value of C(%d, %d) is %d ", n, k, calculateCombinations(n, k));
	}
}

================================================
FILE: InterviewsPreparation/src/main/java/com/javaaid/ip/spraoi/CoinChange.java
================================================
/**
 * 
 */
package com.javaaid.ip.spraoi;

import java.util.Arrays;
import java.util.List;

/**
 * @author Kanahaiya Gupta
 *
 */
public class CoinChange {
	public static void main(String[] args) {
	    Integer actual = CoinChange.countChange(4,Arrays.asList(1,2));
	    System.out.println(actual);
	}
	 public static Integer countChange( Integer money,List<Integer> coins ) {
		 int noOfcoins=coins.size();
		return countNumberOfWays(coins,noOfcoins,money);
	  }
	/**
	 * @param coins
	 * @param noOfcoins
	 * @param money
	 * @return
	 */
	private static Integer countNumberOfWays(List<Integer> coins, int noOfcoins, Integer money) {
		if(money==0)return 1;
		if(money<0)return 0;
		if(noOfcoins<=0 && money>=1)return 0;
		return countNumberOfWays(coins,noOfcoins-1,money)+countNumberOfWays(coins,noOfcoins,money-coins.get(noOfcoins-1));
	}


}


================================================
FILE: InterviewsPreparation/src/main/java/com/javaaid/ip/spraoi/IntegerToRomanNumberConversion.java
================================================
/**
 * 
 */
package com.javaaid.ip.spraoi;

/**
 * @author Kanahaiya Gupta
 *
 */
public class IntegerToRomanNumberConversion {
	public String convertIntToRoman(int num){   
	     String m[] = {"", "M", "MM", "MMM"};
	     String c[] = {"", "C", "CC", "CCC", "CD", "D",  "DC", "DCC", "DCCC", "CM"};
	     String x[] = {"", "X", "XX", "XXX", "XL", "L",  "LX", "LXX", "LXXX", "XC"};
	     String i[] = {"", "I", "II", "III", "IV", "V",   "VI", "VII", "VIII", "IX"};
	         
	     String thousands = m[num/1000];
	     String hundereds = c[(num%1000)/100];
	     String tens =  x[(num%100)/10];
	     String ones = i[num%10];
	         
	     String ans = thousands + hundereds + tens + ones;
	     return ans;
	}

}


================================================
FILE: InterviewsPreparation/src/main/java/com/javaaid/ip/temnos/RajuMarriage.java
================================================
/**
 *Problem statement-
 *--------------------------------
 *Raju and marriage ceremony (100 Marks)
Raju is attending a marriage ceremony. There are lot of people who are coming and going from the gate. Raju is standing near the gate and observing everything. There are
N persons and for each person Raju knows A and B which is the time interval in seconds [A , B ] in which a person is present at the gate. Now Raju wants to answer 2
queries:
Query 1: The maximum number of people which can be present at the gate at any point of time.
Query 2: The maximum time at which there are exactly P people standing at the gate.
Note: If there is no such time for Query 2 then output -1 for the query.
Input Format
First line of input contains an Integer N i.e. the number of rows.
Second line of input contains Integer 2 i.e. the number of columns.
Next N lines of input containing two space separated integers A and B .
Next line contains an Integer P.
Constraints
1 <= N <= 100000
1 <= A <= B <= 10
1 <= P <= 100000
Output Format
2 space separated integer denoting answer to the Query1 and Query2 respectively.
Sample TestCase 1
Input
5
2
1 4
3 5
3 8
5 9
4 10
3
Output
4 8
Explanation
Query 1: The maximum number of people which can be present at the gate at any point of time.
1 2 3 4
3 4 5
3 4 5 6 7 8
5 6 7 8 9
4 5 6 7 8 9 10
Here, in this case at point of time 4 and 5 - we have maximum 4 people. Hence, answer for Query 1 is 4.
Query 2: The maximum time at which there are exactly P people standing at the gate.
1 2 3 4
3 4 5
3 4 5 6 7 8
5 6 7 8 9
4 5 6 7 8 9 10
Here, P=3, So, 8 will be maximum common time for 3 people standing at the gate at one time.
 */

package com.javaaid.ip.temnos;

import java.util.Scanner;

/**
 * @author Kanahaiya Gupta
 *
 */
public class RajuMarriage {
	public static void main(String args[]) throws Exception {
		Scanner sc = new Scanner(System.in);
		int maxNoOfGuest = Integer.MIN_VALUE;
		int maxTime = -1;
		int N = sc.nextInt();
		sc.nextInt();
		int a[] = new int[1000001];
		for (int i = 0; i < N; i++) {
			fillArray(a, sc.nextInt(), sc.nextInt());
		}
		int P = sc.nextInt();
		for (int i = 1; i <=1000000 ; i++) {
			if (a[i]!=0 &&a[i] > maxNoOfGuest) {
				maxNoOfGuest = a[i];
			}
			if ( a[i] == P) {
				maxTime = i;
			}

		}
		System.out.println(maxNoOfGuest);
		System.out.println(maxTime);
		sc.close();
	}

	/**
	 * @param nextInt
	 * @param nextInt2
	 */
	private static void fillArray(int a[], int start, int end) {
		for (int i = start; i <= end; i++) {
			a[i]++;
		}

	}
}


================================================
FILE: InterviewsPreparation/src/main/java/com/javaaid/ip/wissen_infotech/SpecialArrayConversion.java
================================================
/**
 * 
 */
package com.javaaid.ip.wissen_infotech;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author Kanahaiya Gupta
 *
 */
public class SpecialArrayConversion {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int inputArray[] = new int[N];
		for (int i = 0; i < N; i++) {
			inputArray[i] = sc.nextInt();
		}
		convertArray(inputArray);
		printArray(inputArray);
		sc.close();
	}

	/**
	 * @param inputArray
	 */
	private static void convertArray(int[] inputArray) {
		int size = inputArray.length;
		int primeArray[] = new int[size];
		int nonPrimeArray[] = new int[size];
		int primeIndex = 0, nonPrimeIndex = 0, primeCount = 0, k = 0;

		for (int i = 0; i < inputArray.length; i++) {
			int num = inputArray[i];
			if (checkForPrime(num)) {
				primeArray[primeIndex++] = num;
				primeCount++;
			} else {
				nonPrimeArray[nonPrimeIndex++] = num;
			}
		}
		Arrays.sort(primeArray);
		Arrays.sort(nonPrimeArray);
		int index = primeArray.length - primeCount;
		for (; index < primeArray.length; index++) {
			if (primeArray[index] != 0) {
				inputArray[k++] = primeArray[index];
			} else {
				break;
			}

		}
		for (int i = nonPrimeArray.length - 1; i >= primeCount; i--) {
			if (nonPrimeArray[i] != 0) {
				inputArray[k++] = nonPrimeArray[i];
			} else {
				break;
			}

		}
	}

	/**
	 * @param num
	 * @return
	 */
	private static boolean checkForPrime(int num) {
		for(int i=2;2*i<num;i++) {
	        if(num%i==0)
	            return false;
	    }
	    return true;
	}

	/**
	 * @param inputArray
	 */
	private static void printArray(int[] inputArray) {
		for (int i = 0; i < inputArray.length; i++) {
			System.out.print(inputArray[i] + " ");
		}

	}

}


================================================
FILE: InterviewsPreparation/src/main/java/com/javaaid/ip/wissen_infotech/Stats.java
================================================
/**
 * 
 */
package com.javaaid.ip.wissen_infotech;

import java.util.ArrayList;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

/**
 * @author Kanahaiya Gupta
 *
 */

public class Stats {
	public static class StatisticsAggregatorImpl implements StatisticsAggregator {
		ConcurrentHashMap<String, ArrayList<Double>> map=new ConcurrentHashMap<String,ArrayList<Double>>();
		ArrayList list=null;
		volatile int  count=0;
		@Override
		public synchronized  void  putNewPrice(String symbol, double price) {
			// YOUR CODE HERE
			if(map.containsKey(symbol)) {
				 list=map.get(symbol);
			}else {
				list=new ArrayList<Double>();
			}
			 list.add(price);
			 map.put(symbol, list);

		}

		@Override
		public synchronized  double getAveragePrice(String symbol) {
			ArrayList<Double> tmp=map.get(symbol);
			 count=tmp.size();
			Double price=0.0;
			for(Double d:map.get(symbol)) {
				price+=d;
			}
			return price/count;
			// YOUR CODE HERE
		}

		@Override
		public synchronized  int   getTickCount(String symbol) {
			return count;
			// YOUR CODE HERE
		}
	}

	////////////////// DO NOT MODIFY BELOW THIS LINE ///////////////////

	public interface StatisticsAggregator {
		// This is an input. Make note of this price.
		public void putNewPrice(String symbol, double price);

		// Get the average price
		public double getAveragePrice(String symbol);

		// Get the total number of prices recorded
		public int getTickCount(String symbol);
	}

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		while (scanner.hasNext()) {
			final StatisticsAggregator stats = new StatisticsAggregatorImpl();
			final Set<String> symbols = new TreeSet<>();

			String line = scanner.nextLine();
			String[] inputs = line.split(",");
			int threads = Integer.parseInt(inputs[0]);
			ExecutorService pool = Executors.newFixedThreadPool(threads);
			for (int i = 1; i < inputs.length; ++i) {
				String[] tokens = inputs[i].split(" ");
				final String symbol = tokens[0];
				symbols.add(symbol);
				final double price = Double.parseDouble(tokens[1]);
				pool.submit(new Runnable() {
					@Override
					public void run() {
						stats.putNewPrice(symbol, price);
					}
				});

			}
			pool.shutdown();
			try {
				pool.awaitTermination(5000, TimeUnit.MILLISECONDS);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}

			for (String symbol : symbols) {
				System.out.println(
						String.format("%s %.4f %d", symbol, stats.getAveragePrice(symbol), stats.getTickCount(symbol)));
			}
		}
		scanner.close();

	}
}

================================================
FILE: README.md
================================================
<p align="center">
    <a href="https://www.facebook.com/groups/codingip/">
        <img height=85 src="https://github.com/Java-aid/Interview-Preparations/blob/master/InterviewsPreparation/src/main/resources/images/javaAidBanner.png">
    </a>
    <br>For more, join our facebook group "Coding Interview Preparation" by clicking on above image
  <br>
  <br>
</p>



# Interviews-Preparation
  This repository contains coding assessments and their solutions for various IT companies



|   		Company Name  			 |       Problem Statement                                        																																																|                                                                                                     Solution                                                                                                                                                 |
|:----------------------------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
|           App Dynamics			 | [Anagram Difference](https://github.com/Java-aid/Interview-Preparations/blob/master/ProblemStatements/App%20Dynamics/AppDynamics%20Java%20Developer%20Hiring%20Test.pdf)           												   							| [Solution.java](https://github.com/Java-aid/Interview-Preparations/blob/master/InterviewsPreparation/src/main/java/com/javaaid/ip/app_dynamics/AnagramDifference.java)                       																   |
|           App Dynamics			 | [Problem] 																																												   																	| [Solution.java](https://github.com/Java-aid/Interview-Preparations/blob/master/InterviewsPreparation/src/main/java/com/javaaid/ip/app_dynamics/Solution1.java)                       																		   |
|           App Dynamics			 | [Problem]	 	           												   																																													| [Solution.java](https://github.com/Java-aid/Interview-Preparations/blob/master/InterviewsPreparation/src/main/java/com/javaaid/ip/app_dynamics/MeetingScheduler.java)                       																   |
|           App Dynamics			 | [Problem]	 	           												   																																													| [Solution.java](https://github.com/Java-aid/Interview-Preparations/blob/master/InterviewsPreparation/src/main/java/com/javaaid/ip/app_dynamics/UniqueWordFinder.java)                       																   |
|         CA Technologies			 | [The Light Store](https://github.com/Java-aid/Interview-Preparations/blob/master/ProblemStatements/CA%20Technologies/CA_Technologies.pdf)           												   															| [Solution.java](https://github.com/Java-aid/Interview-Preparations/blob/master/InterviewsPreparation/src/main/java/com/javaaid/ip/ca/TheLightStore.java)                       																			   |
|            Cleartrip			     | [Strings Chains](https://github.com/Java-aid/Interview-Preparations/blob/master/ProblemStatements/Cleartrip/cleartrip_hackerrank_test.docx)           												  			  								   			| [Solution.java](https://github.com/Java-aid/Interview-Preparations/blob/master/InterviewsPreparation/src/main/java/com/javaaid/ip/cleartrip/StringChain.java)                       																	 	   |
|          Goldman Sachs			 | [Number Checker](https://github.com/Java-aid/Interview-Preparations/blob/master/ProblemStatements/Goldman%20Sachs/GS%20Online%20Assessment%201_2017.pdf)           																						 	| [Solution.java](https://github.com/Java-aid/Interview-Preparations/blob/master/InterviewsPreparation/src/main/java/com/javaaid/ip/goldman_sachs/NumberChecker.java)                           												   			   |
|          Goldman Sachs			 | [Number Patterns & finding the possible smallest numeric value](https://github.com/Java-aid/Interview-Preparations/blob/master/ProblemStatements/Goldman%20Sachs/GS%20Online%20Assessment%202_2017.pdf)        										    	| [Solution.java](https://github.com/Java-aid/Interview-Preparations/blob/master/InterviewsPreparation/src/main/java/com/javaaid/ip/goldman_sachs/MNStringSolution.java)                        												      		   |
|          Goldman Sachs			 | [Non repeating digit in product](https://github.com/Java-aid/Interview-Preparations/blob/master/ProblemStatements/Goldman%20Sachs/GS%20Online%20Assessment%201_2018.pdf)            																			| [Solution.java](https://github.com/Java-aid/Interview-Preparations/blob/master/InterviewsPreparation/src/main/java/com/javaaid/ip/goldman_sachs/NonRepeatingDigitInProduct.java)              												               |
|          Goldman Sachs			 | [Trucker's profit](https://github.com/Java-aid/Interview-Preparations/blob/master/ProblemStatements/Goldman%20Sachs/GS%20Online%20Assessment%202_2018.pdf)            																						| [Solution.java]                  							  																																																   |
|         	 LensKart				 | [String Game](https://github.com/Java-aid/Interview-Preparations/blob/master/ProblemStatements/LensKart/Lenskart_Hiring_Challenge1.pdf)           												  			   												| [Solution.java](https://github.com/Java-aid/Interview-Preparations/blob/master/InterviewsPreparation/src/main/java/com/javaaid/ip/lenskart/StringGame.java)                       																	  	   |
|         	 LensKart				 | [Max Power](https://github.com/Java-aid/Interview-Preparations/blob/master/ProblemStatements/LensKart/Lenskart_Hiring_Challenge2.pdf)           												  			   													| 																																						                       																	  	   		   |
|         	 LensKart				 | [Thief and Warehouses](https://github.com/Java-aid/Interview-Preparations/blob/master/ProblemStatements/LensKart/Lenskart_Hiring_Challenge3.pdf)           												  			   										| 																																						                       																	  	           |
|         	 MicroSoft				 | [Calculate Nck] 																																	           												  			   										| [Solution.java](https://github.com/Java-aid/Interview-Preparations/blob/master/InterviewsPreparation/src/main/java/com/javaaid/ip/microsoft/CalculateCombinations.java)													  	           					   |
|         Wissen Infotech			 | [Special Array Conversion](https://github.com/Java-aid/Interview-Preparations/blob/master/ProblemStatements/Wissen%20Infotech/Wissen_SpecialArrayConversion_problem.jpg)           															  			    | [Solution.java](https://github.com/Java-aid/Interview-Preparations/blob/master/InterviewsPreparation/src/main/java/com/javaaid/ip/wissen_infotech/SpecialArrayConversion.java)                												       		   |
|         Wissen Infotech			 | [Stats](https://github.com/Java-aid/Interview-Preparations/blob/master/ProblemStatements/Wissen%20Infotech/WissenCodingProblem2_stats.png)           												  			   											| [Solution.java](https://github.com/Java-aid/Interview-Preparations/blob/master/InterviewsPreparation/src/main/java/com/javaaid/ip/wissen_infotech/Stats.java)                       																	       |
|         Wissen Infotech			 | [Balance the log](https://github.com/Java-aid/Interview-Preparations/blob/master/ProblemStatements/Wissen%20Infotech/Wissen_technical_screening_2017.pdf)           												  			  								|              																																										      																	   |
|         Wissen Infotech			 | [Manager names](https://github.com/Java-aid/Interview-Preparations/blob/master/ProblemStatements/Wissen%20Infotech/Wissen_technical_screening_2017_sql.pdf)           												  						  				|              																																										 																	       |
|         Wissen Infotech			 | [Managers](https://github.com/Java-aid/Interview-Preparations/blob/master/ProblemStatements/Wissen%20Infotech/Wissen_technical_screening_2017_sql2.pdf)           												  			  								|              																																										        																   |
|             Spraoi			     | [Coin Change problem](https://github.com/Java-aid/Interview-Preparations/blob/master/ProblemStatements/Sproai/spraoi_Q1.docx)           												  			  							   							    | [Solution.java](https://github.com/Java-aid/Interview-Preparations/blob/master/InterviewsPreparation/src/main/java/com/javaaid/ip/spraoi/CoinChange.java)                       																	 	  	   |
|             Spraoi			     | [Integer to Roman Number Conversion](https://github.com/Java-aid/Interview-Preparations/blob/master/ProblemStatements/Sproai/spraoi_Q2.docx)           												  			  							   				| [Solution.java](https://github.com/Java-aid/Interview-Preparations/blob/master/InterviewsPreparation/src/main/java/com/javaaid/ip/spraoi/IntegerToRomanNumberConversion.java)                 												      		   |
|             Temnos			     | [Raju and marriage ceremony](https://github.com/Java-aid/Interview-Preparations/blob/master/ProblemStatements/Temnos/Coding%20Test_Techgig_Temnos.pdf)           												  			  							    | [Solution.java](https://github.com/Java-aid/Interview-Preparations/blob/master/InterviewsPreparation/src/main/java/com/javaaid/ip/temnos/RajuMarriage.java)                       																	       |
Download .txt
gitextract_lfieso94/

├── InterviewsPreparation/
│   ├── .classpath
│   ├── .gitignore
│   ├── .project
│   ├── .settings/
│   │   ├── org.eclipse.core.resources.prefs
│   │   ├── org.eclipse.jdt.core.prefs
│   │   └── org.eclipse.m2e.core.prefs
│   ├── pom.xml
│   └── src/
│       └── main/
│           └── java/
│               └── com/
│                   └── javaaid/
│                       └── ip/
│                           ├── app_dynamics/
│                           │   ├── AnagramDifference.java
│                           │   ├── MeetingScheduler.java
│                           │   ├── Solution1.java
│                           │   ├── UniqueWordFinder.java
│                           │   └── copy/
│                           │       └── Solution1.java
│                           ├── ca/
│                           │   └── TheLightStore.java
│                           ├── cleartrip/
│                           │   └── StringChain.java
│                           ├── goldman_sachs/
│                           │   ├── MNStringSolution.java
│                           │   ├── NonRepeatingDigitInProduct.java
│                           │   └── NumberChecker.java
│                           ├── lenskart/
│                           │   └── StringGame.java
│                           ├── microsoft/
│                           │   └── CalculateCombinations.java
│                           ├── spraoi/
│                           │   ├── CoinChange.java
│                           │   └── IntegerToRomanNumberConversion.java
│                           ├── temnos/
│                           │   └── RajuMarriage.java
│                           └── wissen_infotech/
│                               ├── SpecialArrayConversion.java
│                               └── Stats.java
├── ProblemStatements/
│   ├── Cleartrip/
│   │   └── cleartrip_hackerrank_test.docx
│   └── Sproai/
│       ├── spraoi_Q1.docx
│       └── spraoi_Q2.docx
└── README.md
Download .txt
SYMBOL INDEX (91 symbols across 17 files)

FILE: InterviewsPreparation/src/main/java/com/javaaid/ip/app_dynamics/AnagramDifference.java
  class AnagramDifference (line 12) | public class AnagramDifference {
    method main (line 14) | public static void main(String[] args) {
    method getMinimumDifference (line 22) | private  int[] getMinimumDifference(String[] a, String[] b) {
    method getAnagramDiff (line 34) | int getAnagramDiff(String s1, String s2)

FILE: InterviewsPreparation/src/main/java/com/javaaid/ip/app_dynamics/MeetingScheduler.java
  class Time (line 25) | class Time {
    method Time (line 29) | public Time(int inTime, int outTime) {
    method getInTime (line 35) | public int getInTime() {
    method setInTime (line 39) | public void setInTime(int inTime) {
    method getOutTime (line 43) | public int getOutTime() {
    method setOutTime (line 47) | public void setOutTime(int outTime) {
  class MeetingScheduler (line 53) | public class MeetingScheduler {
    method main (line 54) | public static void main(String[] args) {
    method getMinRoomCount (line 72) | private static int getMinRoomCount(List<Time> lists) {
    method getMax (line 85) | private static int getMax(int[] a) {
    method fillArray (line 93) | private static void fillArray(Time interval, HashMap<Integer, Integer>...

FILE: InterviewsPreparation/src/main/java/com/javaaid/ip/app_dynamics/Solution1.java
  class Solution1 (line 12) | public class Solution1 {
    method maxProfit (line 13) | public static int maxProfit(int[] a) {
    method main (line 23) | public static void main(String[] args) {

FILE: InterviewsPreparation/src/main/java/com/javaaid/ip/app_dynamics/UniqueWordFinder.java
  class UniqueWordFinder (line 37) | public class UniqueWordFinder {
    method main (line 39) | public static void main(String[] args) {
    method getUniqChar (line 55) | private static boolean getUniqChar(String[] lines) {

FILE: InterviewsPreparation/src/main/java/com/javaaid/ip/app_dynamics/copy/Solution1.java
  class Solution1 (line 12) | public class Solution1 {
    method maxProfit (line 13) | public static int maxProfit(int[] a) {
    method maxDiff (line 23) | int maxDiff(int a[]) {
    method main (line 40) | public static void main(String[] args) {

FILE: InterviewsPreparation/src/main/java/com/javaaid/ip/ca/TheLightStore.java
  class TheLightStore (line 12) | public class TheLightStore {
    method getOpCount (line 14) | private static int getOpCount(String str1, String str2) {
    method main (line 32) | public static void main(String args[]) throws Exception {

FILE: InterviewsPreparation/src/main/java/com/javaaid/ip/cleartrip/StringChain.java
  class StringChain (line 12) | public class StringChain {
    method main (line 16) | public static void main(String[] args) {
    method calulateLongestChain (line 34) | private static int calulateLongestChain(String[] words) {
    method findMaxChain (line 48) | private static int findMaxChain(String[] words, String word, int lenCo...
    method wordsContains (line 66) | private static boolean wordsContains(String[] words, String string) {

FILE: InterviewsPreparation/src/main/java/com/javaaid/ip/goldman_sachs/MNStringSolution.java
  class MNStringSolution (line 38) | public class MNStringSolution {
    method findPossibleSmallestNumberMatchingPattern (line 44) | static int findPossibleSmallestNumberMatchingPattern(String pattern) {
    method validatePattern (line 55) | private static boolean validatePattern(String pattern) {
    method getMNCount (line 64) | private static int getMNCount(String pattern) {
    method main (line 77) | public static void main(String[] args) throws IOException {
    method processString (line 106) | private static String processString(String input) {
    method getConsecutiveCount (line 127) | public static int getConsecutiveCount(String input, int index, char ch) {
    method getElement (line 140) | private static String getElement(int k) {

FILE: InterviewsPreparation/src/main/java/com/javaaid/ip/goldman_sachs/NonRepeatingDigitInProduct.java
  class NonRepeatingDigitInProduct (line 31) | public class NonRepeatingDigitInProduct {
    method main (line 33) | public static void main(String[] args) {
    method nonRepeatingDigitProductCount (line 39) | static int nonRepeatingDigitProductCount(int x, int y, int z) {

FILE: InterviewsPreparation/src/main/java/com/javaaid/ip/goldman_sachs/NumberChecker.java
  class NumberChecker (line 33) | public class NumberChecker {
    method findQualifiedNumbers (line 34) | static String findQualifiedNumbers(int[] numberArray) {
    method main (line 46) | public static void main(String[] args) throws IOException {

FILE: InterviewsPreparation/src/main/java/com/javaaid/ip/lenskart/StringGame.java
  class StringGame (line 17) | public class StringGame {
    method solve (line 22) | void solve() {
    method getWinner (line 35) | private static int getWinner(String in) {
    method run (line 50) | void run() throws Exception {
    method main (line 61) | public static void main(String[] args) throws Exception {
    method readByte (line 68) | private int readByte() {
    method isSpaceChar (line 84) | private boolean isSpaceChar(int c) {
    method skip (line 88) | private int skip() {
    method nd (line 95) | private double nd() {
    method nc (line 99) | private char nc() {
    method ns (line 103) | private String ns() {
    method ns (line 113) | private char[] ns(int n) {
    method nm (line 123) | private char[][] nm(int n, int m) {
    method na (line 130) | private int[] na(int n) {
    method ni (line 137) | private int ni() {
    method nl (line 157) | private long nl() {
    method tr (line 178) | private static void tr(Object... o) {

FILE: InterviewsPreparation/src/main/java/com/javaaid/ip/microsoft/CalculateCombinations.java
  class CalculateCombinations (line 12) | public class CalculateCombinations {
    method calculateCombinations (line 14) | static long calculateCombinations(int n, int k) {
    method main (line 27) | public static void main(String[] args) {

FILE: InterviewsPreparation/src/main/java/com/javaaid/ip/spraoi/CoinChange.java
  class CoinChange (line 13) | public class CoinChange {
    method main (line 14) | public static void main(String[] args) {
    method countChange (line 18) | public static Integer countChange( Integer money,List<Integer> coins ) {
    method countNumberOfWays (line 28) | private static Integer countNumberOfWays(List<Integer> coins, int noOf...

FILE: InterviewsPreparation/src/main/java/com/javaaid/ip/spraoi/IntegerToRomanNumberConversion.java
  class IntegerToRomanNumberConversion (line 10) | public class IntegerToRomanNumberConversion {
    method convertIntToRoman (line 11) | public String convertIntToRoman(int num){

FILE: InterviewsPreparation/src/main/java/com/javaaid/ip/temnos/RajuMarriage.java
  class RajuMarriage (line 59) | public class RajuMarriage {
    method main (line 60) | public static void main(String args[]) throws Exception {
    method fillArray (line 89) | private static void fillArray(int a[], int start, int end) {

FILE: InterviewsPreparation/src/main/java/com/javaaid/ip/wissen_infotech/SpecialArrayConversion.java
  class SpecialArrayConversion (line 13) | public class SpecialArrayConversion {
    method main (line 15) | public static void main(String[] args) {
    method convertArray (line 30) | private static void convertArray(int[] inputArray) {
    method checkForPrime (line 70) | private static boolean checkForPrime(int num) {
    method printArray (line 81) | private static void printArray(int[] inputArray) {

FILE: InterviewsPreparation/src/main/java/com/javaaid/ip/wissen_infotech/Stats.java
  class Stats (line 20) | public class Stats {
    class StatisticsAggregatorImpl (line 21) | public static class StatisticsAggregatorImpl implements StatisticsAggr...
      method putNewPrice (line 25) | @Override
      method getAveragePrice (line 38) | @Override
      method getTickCount (line 50) | @Override
    type StatisticsAggregator (line 59) | public interface StatisticsAggregator {
      method putNewPrice (line 61) | public void putNewPrice(String symbol, double price);
      method getAveragePrice (line 64) | public double getAveragePrice(String symbol);
      method getTickCount (line 67) | public int getTickCount(String symbol);
    method main (line 70) | public static void main(String[] args) {
Condensed preview — 28 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (50K chars).
[
  {
    "path": "InterviewsPreparation/.classpath",
    "chars": 1081,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<classpath>\r\n\t<classpathentry kind=\"src\" output=\"target/test-classes\" path=\"src/"
  },
  {
    "path": "InterviewsPreparation/.gitignore",
    "chars": 9,
    "preview": "/target/\n"
  },
  {
    "path": "InterviewsPreparation/.project",
    "chars": 574,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<projectDescription>\r\n\t<name>Interviews-Preparation</name>\r\n\t<comment></comment>"
  },
  {
    "path": "InterviewsPreparation/.settings/org.eclipse.core.resources.prefs",
    "chars": 119,
    "preview": "eclipse.preferences.version=1\r\nencoding//src/main/java=UTF-8\r\nencoding//src/test/java=UTF-8\r\nencoding/<project>=UTF-8\r\n"
  },
  {
    "path": "InterviewsPreparation/.settings/org.eclipse.jdt.core.prefs",
    "chars": 430,
    "preview": "eclipse.preferences.version=1\r\norg.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled\r\norg.eclipse.jdt.core.com"
  },
  {
    "path": "InterviewsPreparation/.settings/org.eclipse.m2e.core.prefs",
    "chars": 90,
    "preview": "activeProfiles=\r\neclipse.preferences.version=1\r\nresolveWorkspaceProjects=true\r\nversion=1\r\n"
  },
  {
    "path": "InterviewsPreparation/pom.xml",
    "chars": 825,
    "preview": "<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\r\n  xsi:schemaLo"
  },
  {
    "path": "InterviewsPreparation/src/main/java/com/javaaid/ip/app_dynamics/AnagramDifference.java",
    "chars": 1232,
    "preview": "/**\n * \n */\npackage com.javaaid.ip.app_dynamics;\n\nimport java.util.Scanner;\n\n/**\n * @author Kanahaiya Gupta\n *\n */\npubli"
  },
  {
    "path": "InterviewsPreparation/src/main/java/com/javaaid/ip/app_dynamics/MeetingScheduler.java",
    "chars": 2279,
    "preview": "/**\n * Problem Statement-\n * ------------------------------\n * There are lot of meeting which has been schedule for toda"
  },
  {
    "path": "InterviewsPreparation/src/main/java/com/javaaid/ip/app_dynamics/Solution1.java",
    "chars": 678,
    "preview": "/**\n * \n */\npackage com.javaaid.ip.app_dynamics;\n\nimport java.util.Scanner;\n\n/**\n * @author Kanahaiya Gupta\n *\n */\npubli"
  },
  {
    "path": "InterviewsPreparation/src/main/java/com/javaaid/ip/app_dynamics/UniqueWordFinder.java",
    "chars": 1419,
    "preview": "/**\n *Problem Statement-\n *------------------------------\n *There is a file containing plain text, you need to tell whet"
  },
  {
    "path": "InterviewsPreparation/src/main/java/com/javaaid/ip/app_dynamics/copy/Solution1.java",
    "chars": 995,
    "preview": "/**\n * \n */\npackage com.javaaid.ip.app_dynamics.copy;\n\nimport java.util.Scanner;\n\n/**\n * @author Kanahaiya Gupta\n *\n */\n"
  },
  {
    "path": "InterviewsPreparation/src/main/java/com/javaaid/ip/ca/TheLightStore.java",
    "chars": 902,
    "preview": "/**\n * \n */\npackage com.javaaid.ip.ca;\n\nimport java.util.Scanner;\n\n/**\n * @author Kanahaiya Gupta\n *\n */\npublic class Th"
  },
  {
    "path": "InterviewsPreparation/src/main/java/com/javaaid/ip/cleartrip/StringChain.java",
    "chars": 1523,
    "preview": "/**\n * \n */\npackage com.javaaid.ip.cleartrip;\n\nimport java.util.Scanner;\n\n/**\n * @author Kanahaiya Gupta\n *\n */\npublic c"
  },
  {
    "path": "InterviewsPreparation/src/main/java/com/javaaid/ip/goldman_sachs/MNStringSolution.java",
    "chars": 4086,
    "preview": "/**\n * problem statement-\n * ------------------------------------\n * Question:\n\tGiven a Pattern containing only Ns and M"
  },
  {
    "path": "InterviewsPreparation/src/main/java/com/javaaid/ip/goldman_sachs/NonRepeatingDigitInProduct.java",
    "chars": 1626,
    "preview": "/**\nproblem statement-\n--------------------------------\nGiven a number 'x', and a range of ‘y’ to ‘z’, please find the c"
  },
  {
    "path": "InterviewsPreparation/src/main/java/com/javaaid/ip/goldman_sachs/NumberChecker.java",
    "chars": 2111,
    "preview": "/**\n*problem statement-\n\t---------------------------------\n\tGiven an integer array as input, find out the integers which"
  },
  {
    "path": "InterviewsPreparation/src/main/java/com/javaaid/ip/lenskart/StringGame.java",
    "chars": 3372,
    "preview": "/**\n * \n */\npackage com.javaaid.ip.lenskart;\n\nimport java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport ja"
  },
  {
    "path": "InterviewsPreparation/src/main/java/com/javaaid/ip/microsoft/CalculateCombinations.java",
    "chars": 642,
    "preview": "/**\nMicrosoft coding test for SDET\ncalculate Nck for given n & k\n * \n */\npackage com.javaaid.ip.microsoft;\n\n/**\n * @auth"
  },
  {
    "path": "InterviewsPreparation/src/main/java/com/javaaid/ip/spraoi/CoinChange.java",
    "chars": 848,
    "preview": "/**\n * \n */\npackage com.javaaid.ip.spraoi;\n\nimport java.util.Arrays;\nimport java.util.List;\n\n/**\n * @author Kanahaiya Gu"
  },
  {
    "path": "InterviewsPreparation/src/main/java/com/javaaid/ip/spraoi/IntegerToRomanNumberConversion.java",
    "chars": 717,
    "preview": "/**\n * \n */\npackage com.javaaid.ip.spraoi;\n\n/**\n * @author Kanahaiya Gupta\n *\n */\npublic class IntegerToRomanNumberConve"
  },
  {
    "path": "InterviewsPreparation/src/main/java/com/javaaid/ip/temnos/RajuMarriage.java",
    "chars": 2532,
    "preview": "/**\n *Problem statement-\n *--------------------------------\n *Raju and marriage ceremony (100 Marks)\nRaju is attending a"
  },
  {
    "path": "InterviewsPreparation/src/main/java/com/javaaid/ip/wissen_infotech/SpecialArrayConversion.java",
    "chars": 1750,
    "preview": "/**\n * \n */\npackage com.javaaid.ip.wissen_infotech;\n\nimport java.util.Arrays;\nimport java.util.Scanner;\n\n/**\n * @author "
  },
  {
    "path": "InterviewsPreparation/src/main/java/com/javaaid/ip/wissen_infotech/Stats.java",
    "chars": 2760,
    "preview": "/**\n * \n */\npackage com.javaaid.ip.wissen_infotech;\n\nimport java.util.ArrayList;\nimport java.util.Scanner;\nimport java.u"
  },
  {
    "path": "README.md",
    "chars": 9725,
    "preview": "<p align=\"center\">\n    <a href=\"https://www.facebook.com/groups/codingip/\">\n        <img height=85 src=\"https://github.c"
  }
]

// ... and 3 more files (download for full content)

About this extraction

This page contains the full source code of the Java-aid/Interview-Preparations GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 28 files (41.3 KB), approximately 12.5k tokens, and a symbol index with 91 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!