Oracle Interview Question for Senior Software Development Engineers


Country: India
Interview Type: In-Person




Comment hidden because of low score. Click to expand.
0
of 0 vote

for(int i=0; i<array_length; i++)
	{
		for (int j= i+1; j<array_length; j++)
		{
			if (array[i]==array[j])
			{
				// match found
				return;
			}
		}
	}

- Anupom Chakrabarty July 05, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

private static void FindFirstDuplicate(int[] arr)
{
List<int> previousItems = new List<int>();
for (int i = 0; i < arr.Length; i++)
{
if (previousItems.Contains(arr[i]))
{
Console.WriteLine("First Duplicate Occurence is {0}", arr[i]);
return;
}
previousItems.Add(arr[i]);
}
}

- sathish July 13, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

import java.util.Map;
import java.util.HashMap;
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		int[] intArray = {5, 4, 6, 8, 9};
		Map<Integer, Integer> freqCountMap = new HashMap<Integer, Integer>();
		for(int a : intArray) {
			Integer k = freqCountMap.get(a);
			if(k != null) {
				System.out.println("First duplicate occurrence is for " + a);
				break;
			}
			else {
				freqCountMap.put(a, 1);
			}
		}
	}
}

- Anonymous July 27, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

import java.util.Map;
import java.util.HashMap;
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		int[] intArray = {5, 4, 6, 8, 9};
		Map<Integer, Integer> freqCountMap = new HashMap<Integer, Integer>();
		for(int a : intArray) {
			Integer k = freqCountMap.get(a);
			if(k != null) {
				System.out.println("First duplicate occurrence is for " + a);
				break;
			}
			else {
				freqCountMap.put(a, 1);
			}
		}
	}
}

- Anonymous July 27, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

import java.util.Map;
import java.util.HashMap;
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		int[] intArray = {5, 4, 6, 8, 9};
		Map<Integer, Integer> freqCountMap = new HashMap<Integer, Integer>();
		for(int a : intArray) {
			Integer k = freqCountMap.get(a);
			if(k != null) {
				System.out.println("First duplicate occurrence is for " + a);
				break;
			}
			else {
				freqCountMap.put(a, 1);
			}
		}
	}
}

- GodOfWar4 July 27, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

class Main{
static void printFirstRepeating(int arr[]) {
int min = -1;
HashSet<Integer> set = new HashSet<>();
for (int i=arr.length-1; i>=0; i--) {
if (set.contains(arr[i]))
min = i;
else
set.add(arr[i]);
}
if (min != -1)
System.out.println("The first repeating element is " + arr[min]);
else
System.out.println("There are no repeating elements");
}
public static void main (String[] args) throws java.lang.Exception {
int arr[] = {10, 5, 3, 4, 3, 5, 6};
printFirstRepeating(arr);
}
}

- preety.bit36 July 28, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

class Main{
static void printFirstRepeating(int arr[]) {
int min = -1;
HashSet<Integer> set = new HashSet<>();
for (int i=arr.length-1; i>=0; i--) {
if (set.contains(arr[i]))
min = i;
else
set.add(arr[i]);
}
if (min != -1)
System.out.println("The first repeating element is " + arr[min]);
else
System.out.println("There are no repeating elements");
}
public static void main (String[] args) throws java.lang.Exception {
int arr[] = {10, 5, 3, 4, 3, 5, 6};
printFirstRepeating(arr);
}
}

- Anonymous August 17, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

class MyCode {
  public static void main (String[] args) {
        
      int[] numbers = {3,4,6,7,2,4,8,3,3,0};
      HashSet<Integer> viewed = new HashSet<>();
      
      int index = -1;

      for(int i=0; i < numbers.length; i++) {
        if(viewed.contains(numbers[i])) {
            index = i;
            break;
          }else {
            viewed.add(numbers[i]);  
          }
      }             
    System.out.printf("index = %d, value=%d", index, numbers[index]);
  }
}

- GSS August 31, 2018 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More