Senior Software Development Engineer Interview Questions
- -1of 1 vote
Answersfind count of number between 0 to n number equal 2 in Golang
- yeshwanthchowdaryjampala.dr November 30, 2022 in India for 6| Report Duplicate | Flag | PURGE
Senior Software Development Engineer - 0of 0 votes
AnswersNumber of occurrences of 2 as a digit in numbers from 0 to n
- yeshwanthchowdaryjampala.dr November 30, 2022 in India for 6
tell me the answer:
package main
import "fmt"
//var count int
func number(n int, d int) int {
count := 0
itr := d
for itr <= n {
if itr%10 == d {
count += 1
if itr != 0 && itr/10 == d {
count += 1
itr += 1
}
} else if itr/10 == d-1 {
itr = itr + (10 - d)
} else {
itr = itr + 10
}
}
return count
}
func main() {
//count << number(n, d)
//count := number(n, d)
fmt.Println(number(25, 2))
//fmt.Println(number(25, 2))
}| Report Duplicate | Flag | PURGE
Senior Software Development Engineer golang code - 0of 0 votes
AnswerSuppose we have some input data describing a graph of relationships between parents and children over multiple generations. The data is formatted as a list of (parent, child) pairs, where each individual is assigned a unique positive integer identifier.
<p>
For example, in this diagram, 3 is a child of 1 and 2, and 5 is a child of 4:
<p>
1 2 4 15
\ / / | \ /
3 5 8 9
\ / \ \
6 7 11
<p>
<p>
Sample input/output (pseudodata):
<p>
parentChildPairs = [
(1, 3), (2, 3), (3, 6), (5, 6), (15, 9),
(5, 7), (4, 5), (4, 8), (4, 9), (9, 11)
]
<p>
<p>
Write a function that takes this data as input and returns two collections: one containing all individuals with zero known parents, and one containing all individuals with exactly one known parent.
<p>
<p>
Output may be in any order:
<p>
findNodesWithZeroAndOneParents(parentChildPairs) => [
[1, 2, 4, 15], // Individuals with zero parents
[5, 7, 8, 11] // Individuals with exactly one parent
]
<p>
n: number of pairs in the input
- Manoj May 04, 2021 in India for Senior Software Engineerpublic static void main(String[] argv) { int[][] parentChildPairs = new int[][]{ {1, 3}, {2, 3}, {3, 6}, {5, 6}, {15, 9}, {5, 7}, {4, 5}, {4, 8}, {4, 9}, {9, 11}}; findNodesWithZeroAndOneParents(parentChildPairs); } public static void findNodesWithZeroAndOneParents(int[][] parentChildPairs) { Map<Integer, List<Integer>> childAncestor = new HashMap<>(); for (int[] parentChildPair : parentChildPairs) { int parent = parentChildPair[0]; int child = parentChildPair[1]; if (!childAncestor.containsKey(child)) { childAncestor.put(child, new ArrayList<>()); } List<Integer> parentValue = childAncestor.get(child); parentValue.add(parent); childAncestor.put(child, parentValue); } System.out.println(childAncestor.toString()); dfs(childAncestor); } private static void dfs(Map<Integer, List<Integer>> childAncestor) { Set<Integer> childerOneParent = new HashSet<>(); Set<Integer> parentWithOutParent = new HashSet<>(); for (Map.Entry<Integer, List<Integer>> parent : childAncestor.entrySet()) { if (parent.getValue().size() == 1) { childerOneParent.add(parent.getKey()); } List<Integer> part = parent.getValue(); for (Integer p : part) { if (!childAncestor.containsKey(p)) { parentWithOutParent.add(p); } } } System.out.println(childerOneParent.toString() + " / " + parentWithOutParent.toString()); } }
| Report Duplicate | Flag | PURGE
Sap Labs Senior Software Development Engineer Graphics - 0of 0 votes
AnswersCome up with a low-level design for an In-Memory Database.
- zapper.ethan March 19, 2021 in United States| Report Duplicate | Flag | PURGE
Amazon Senior Software Development Engineer design - 1of 1 vote
AnswersYou have an integer array. Starting from arr[startIndex], follow each element to the index it points to. You continue to do this until you find a cycle. Return the length of the cycle. If no cycle is found return -1
- rock January 26, 2021 in United States
forexample {1, 0}, 0) => 2
{1, 2, 0}, 0) => 3| Report Duplicate | Flag | PURGE
Goldman Sachs Senior Software Development Engineer Java - 1of 1 vote
AnswersYour input is a double array, and you can use *, +, -, and () parenthesis anywhere to create and output the maximum possible value.
- _M_ November 26, 2020 in India
Ex:
input is {3,4,5,1} --> output: 72
input is {1,1,1,5} --> output: 15
Follow up, if there are numbers <0
Already posted question ( 3yrs back)
my doubt is can we solve this using multiplication only ( special case 0 and 1 we need to use addition for these alone
ie. if ar[i]==1
max(result*ar[i-1]+1,result*ar[i+1]+1)
)| Report Duplicate | Flag | PURGE
Google Senior Software Development Engineer - 0of 0 votes
AnswersA Fibonacci sequence is defined recursively by:
- Manoj September 17, 2020 in India for Senior Software Engineer
F0 = 0
F1 = 1
Fn = Fn − 1 + Fn − 2, for integer n > 1.
One way of generalizing the Fibonacci sequence is by starting with any pair of numbers and extending to negative values of n.
Given two terms of a generalized Fibonacci sequence Fp and Fq, their positions p and q respectively and a position r, find Fr.
Input Format
The first line of the input contains an integer t denoting the number of test cases.
Each test case contains three lines.
First line of each test case contains two space separated integers p and Fp
Second line contains two space separated integers q and Fq
Third line contains an integer r
Output Format
For each test case, print Fr which is the term of the sequence at position r.
If Fr is not an integer, represent it as an irreducible fraction in the form a/b where b > 0.
Sample Input
0 1
6 13
10
3 65
6 315
-10
0 11
1 -6
2
9 36
15 646
-5
11 72
20 5473
6
Sample Output
89
4620
5
-1/4
13/2| Report Duplicate | Flag | PURGE
Sap Labs Senior Software Development Engineer Java - 0of 0 votes
AnswersDesign database schema with entity and relations to store the family tree of a person.
- neer.1304 June 01, 2020 in United States| Report Duplicate | Flag | PURGE
Microsoft Senior Software Development Engineer Database - 0of 0 votes
AnswersDesign a low level design and db schema for railway reservation system for supporting following 2 features -
- neer.1304 June 01, 2020 in United States
1) User would give source city, destination city and date as input and would get the list of trains matching the criteria.
2) On selection of a train from the list user should be able to see the schedule of the train including the arrival time, departure time and station name.| Report Duplicate | Flag | PURGE
Microsoft Senior Software Development Engineer design - 0of 0 votes
AnswersGiven two very large files – first contains Id and name, another one contains Id and address – you need to create 3rd file which will contain id, name, and address. -First, ask the clarifying questions and then tell the approach.
- neer.1304 May 19, 2020 in United States| Report Duplicate | Flag | PURGE
Microsoft Senior Software Development Engineer Algorithm - 0of 0 votes
AnswersTwo tables employee (contains name and Id) and employee details having work experience history (contains Id, fromYear, toYear) – find out all the employees who worked w/o career break.
- neer.1304 May 19, 2020 in United States
Java implementation for the same.
From the same table list the name, fromYear, toYear for all employee.
Dependency Injection.
Design patterns which can be used.| Report Duplicate | Flag | PURGE
Microsoft Senior Software Development Engineer Algorithm - 0of 0 votes
AnswerYou are given an N-Dimensional list with 2 methods:
- neer.1304 May 27, 2019 in United States
i) getDim -> returns the dimensions .e.g [5,4,3].
ii) getElement([i,j,k]) -> return list[i][j][k] . You have to implement a method to sum all elements in the list.| Report Duplicate | Flag | PURGE
Linkedin Senior Software Development Engineer Algorithm - 0of 0 votes
AnswersGiven 2 trees T1 & T2 (both can have > 2 childs), write an algorithm to find if T2 is a subtree of T1.
- sanjos February 09, 2019 in United States
Follow up question, for any branch in T1
a->b->c->d
the following is a valid branch in tree T2(i.e. the isSubTree() algorithm mush evaluate to true in below circumstances)
a->d
a->c->d
c->d| Report Duplicate | Flag | PURGE
Senior Software Development Engineer Algorithm - 0of 0 votes
AnswersImplement singleton pattern
- reshma.dhotre November 30, 2018 in India
All types of containers, datastrutures, there differences, Project details, C++ concepts| Report Duplicate | Flag | PURGE
Bloomberg LP Senior Software Development Engineer - 0of 0 votes
AnswersImplement phone book <unique name, number>
- reshma.dhotre November 30, 2018 in India
1.Sorted phone book
2.searching based on name
3Searching based on number. What are the data strutures required| Report Duplicate | Flag | PURGE
Bloomberg LP Senior Software Development Engineer Data Structures - 0of 0 votes
Answer#include <iostream>
- reshma.dhotre November 30, 2018 in India
using namespace std;
int main()
{
int a = 32, *ptr = &a;
char ch = 'A', &cho = ch;
cho += a;
*ptr += ch;
cout << a << ", " << ch << endl;
return 0
}| Report Duplicate | Flag | PURGE
Bloomberg LP Senior Software Development Engineer C++ - 0of 0 votes
Answercode Bubble sort, and modify it to return if the array is already sorted.
- reshma.dhotre November 30, 2018 in India
2.If single swap is needed perform and break without going through o(n2) looping| Report Duplicate | Flag | PURGE
Bloomberg LP Senior Software Development Engineer Algorithm - 2of 2 votes
AnswersGiven 2 strings representing very large numbers (these are not representable as a BigInteger or other various type) write a method for adding the two numbers and returning their sum.
- Scott.T.Rogers July 06, 2018 in United States| Report Duplicate | Flag | PURGE
Facebook Senior Software Development Engineer Algorithm - 0of 0 votes
AnswersRound 3- Find the first duplicate occurence of a number in an array
- prashant.tah July 03, 2018 in India| Report Duplicate | Flag | PURGE
Oracle Senior Software Development Engineer Java - 0of 0 votes
AnswersRound 3 - puzzle-there are 8 coins out of which 1 coin is faulty.The faulty coin has a lesser weight than the rest of coins which all have the same weight.You have been given a weighing balance with a pulley.Find the faulty coin
- prashant.tah July 03, 2018 in India| Report Duplicate | Flag | PURGE
Oracle Senior Software Development Engineer Puzzle - 0of 0 votes
AnswersRound 3 - Write a java program to print a matrix in spiral
- prashant.tah July 03, 2018 in India| Report Duplicate | Flag | PURGE
Oracle Senior Software Development Engineer Java - 0of 0 votes
AnswersRound 2 - Write a java program to determine if a 10 digit number is magic number.A number is magic number if it has all digits between 1 to 6 occuring in it or if it has any number between 0 to 9 occuring thrice or if it contains three consecutilvely increasing or decreasing digits differing by 1 example 345 or 543
- prashant.tah July 03, 2018 in India| Report Duplicate | Flag | PURGE
Oracle Senior Software Development Engineer Java - 0of 0 votes
AnswersRound 2 - write java code to create the following pattern
- prashant.tah July 03, 2018 in India
*
* * *
* * * * *
* * * * * * *
* * * * * * * * *| Report Duplicate | Flag | PURGE
Oracle Senior Software Development Engineer Java - 0of 0 votes
AnswersRound 1-question 1 - given an array of stock prices for n days.Write an algorithm to maximize the profit of a customer such that he can buy and sell only once.
- prashant.tah July 03, 2018 in India
-Question 2
Prove that complexity for searching in arraylist is o(n)
and adding is o(1)| Report Duplicate | Flag | PURGE
Oracle Senior Software Development Engineer Java - 0of 0 votes
Answerswrite java code to create the following pattern
- prashant.tah July 03, 2018 in India
*
* * *
* * * * *
* * * * * * *
* * * * * * * * *| Report Duplicate | Flag | PURGE
Oracle Senior Software Development Engineer Java - 0of 0 votes
AnswerRound 2- puzzle given 4 pair of socks of different colors(Red,green,blue and yellow)
- prashant.tah July 03, 2018 in India
Arrange the socks in such a way such that there are exacly 4 socks between the yellow socks,3 between the red ones and 2 between the green| Report Duplicate | Flag | PURGE
Oracle Senior Software Development Engineer - 0of 0 votes
AnswersRound 1-Question 2
- prashant.tah July 03, 2018 in India
Prove that complexity for searching in arraylist is o(n)| Report Duplicate | Flag | PURGE
Oracle Senior Software Development Engineer - 0of 0 votes
AnswersRound 1-Question 1
- prashant.tah July 03, 2018 in India
1)Given an array of stock prices for 7 continuous days.Write an algorithm to maximize the profit for a customer who buys stock on any day and sells it later.Buying and selling can happen only once and selling should happen on any day after buying| Report Duplicate | Flag | PURGE
Oracle Senior Software Development Engineer Java - 0of 0 votes
AnswersDesign a system like HackerRank/Codechef.
- ANONU June 20, 2018 in United States| Report Duplicate | Flag | PURGE
Uber Senior Software Development Engineer System Design - 0of 0 votes
AnswersSearch for a sorted integer in an integer array that has been rotated multiple times.
- teli.vaibhav May 14, 2018 in United States| Report Duplicate | Flag | PURGE
Samsung Senior Software Development Engineer Algorithm