· 6 years ago · Nov 20, 2019, 09:08 AM
1questions were mostly about different Facebook features and apps.
2Projects
3core java and db questions
4How sorting in database works? - merge sort/external sort depending on memory
5What is a linked list?
6It is a linear data structure that stores data and a referenced to another node (also known as next). It does not store nodes in contiguous memory locations. As in they are not continuous. Like in an array.
7Behavioral questions
8Basic OOD questions
9
10Why Walmart
11Being a vivd Walmart shopper myself, I have thoruoughly agree with Walmart’s mission of “save people money so they can live better.” Being at Walmart would give me an opportunity to impact millions of lives and almost every household goes to Walmart or uses the app or the website.
12
13
14Would you rather be an individual contributor or work in a team?
15
16Where do you see yourself in 5 years
17I see myself owning various applications and having in depth knowledge of at least two technologies and hopefully start exposing myself with more new technologies and maybe mentoring a few new grads on interns like myself.
18
19
20System design: please design TinyURL.
21Course schedule
22FizzBuzz
23Searching an element in BST, Design Questions mostly, Stock Price question,
24public Node search(Node root, int key)
25{
26 // Base Cases: root is null or key is present at root
27 if (root==null || root.key==key)
28 return root;
29
30 // val is greater than root's key
31 if (root.key > key)
32 return search(root.left, key);
33
34 // val is less than root's key
35 return search(root.right, key);
36}
37
38Restful web services
39implement a reservation algorithm
40implement some sort algorithm
41Validate BST
42
43Get max width of a binary tree
44• Get the maximum profit if the shares can be bought and sold on any day Answer Question
45• Write an hash function to generate values between 20-100 1 Answer
46• Find the missing number in a randomly sorted array Answer Question
47• Generate all possible ip address given an ip address Answer Question
48• Given all robotic directions.. Give the shortest distance to reach the same destination
49• OOP -Conceptual
50• pattern matching question
51
52
53
54
55
56
57
58Subtree of a tree
59Print the matrix in zigzag form. – spiral and diagonal traversal
60Notes about each data structure
61All runtimes
62hanoi tower puzzle
63Explain how and when Cassandra and other No-SQL databases take advantage to SQL databases like Oracle, DB2, MS-SQLServer etc.
64
65
66Median in incoming stream of number.
67 Longest Increasing subsequence.
68Dictionary word problem,
69 K reversal of link list.
70Max area under Histogram.
71Various type of caching techniques.
72 Linear and logistic regression.
73Trashing in OS.
74How can you avoid trashing.
75 Deadlock avoidance.
76
771.An array in which each element occurs in pairs except one. How can u find it?
782.Check whether a given binary tree is binary search tree or not?
793.How to check whether a given point lies in a triangle or not?
804. Implement a stack using 2 queues.
815. What is paging? Difference b/w paging and segmentation?
826. Different types of memories.(primary,secondary)
837. How will u search in a rotated array in minimum time complexity?
848. Print all the pairs which make sum x in an array of n integers?
859. Print all nodes in a binary tree in zigzag format.
861.Dynamic programming( longest increasing sequence)
872.dynamic programming (longest ap sequence)
883. how can generate a different string every time.
894. how can you compare 2 elements without using any relational operator?
905. You need to deliver goods to n different places, you have fuel constraint and a delivery time limit for each of the n places. Design a algo to deliver the goods efficiently. (combination of 2 graph algorithms)
916. LRU cache data structure implementation.
927. some questions on my project.
938.BFS,DFS
941.How are some sites blocked in a particular place?
95Fibonacci series,Project explanation, tree traversal.
96
97Basic Computer Science algorithm and data structures questions about stacks, queues, binary trees, linked lists and hash tables, graphs
98
99The interviewer asked me questions based on my projects. I was questioned on GET and POST methods of HTTP. Then he asked my favourite subjects and questioned me on hashmaps and multi-threading in OS.
100
101
102
103JVM and optimisations.
104SOA vs rest
105
1061. Questions on Java Strings, Arraylist & Hashmap Implementation.
1072. Question Based on Stream of words like Trending Tweets and some designed based questions.
108
109
1103.discussion about hashmap and internal implementation
1114. discussion about hashcode() and equal method in java.
1125. questions on java collections
113
114
115asked system design question- design Facebook
116Difference between Abstract Class and Interface in Java
117
118In managerial round asked some questions about database and asked me to design Walmart database (system design)
119
120What feature of Twitter would you like to change?
1215. Give us a way to schedule tweets right from Twitter
122
1234. Make it easy to switch between Twitter accounts
124
1252. Make it possible to arrange my Twitter Lists
126Topological Sort, Spiral Matrix traversal, SQL questions, Linux commands, Data structures
1271)Reverse a String
1282)While-infinity loop error condition
1293)Array example
1304)Some object oriented programming questions.
131Find Minimum in Rotated Sorted Array II.
132
133
134
135
136 java dependency inject, database union all and union difference, c, which join
137
138union all – bring in all the rows based on the required query condition
139union – bring distinct
140
141
142SELECT col1
143 FROM table1
144UNION ALL
145SELECT col2
146 FROM table2;
147
148SELECT col1
149 FROM table1
150UNION
151SELECT col2
152 FROM table2;
153The SQL LEFT JOIN returns all rows from the left table, even if there are no matches in the right table. This means that if the ON clause matches 0 (zero) records in the right table; the join will still return a row in the result, but with NULL in each column from the right table.
154
155Atomic: Transaction must be treated as an atomic unit.All the transactions should happen or none should happen.
156Consistency: The database must remain in a consistent state after any transaction. Transactions must be done in isolation. One transaction after another to maintain consistency.
157Insolation. Same as above
158Durability. The database should be durable enough to hold all its latest updates even if the system fails or restarts.
159
160Why use celery and rabbitmq? Is there any other way to implement asynchronous queues in python? What database, sql and non-sql difference used to know?
161Then I asked for a java project: How do you use multithreading? (After answering threadpool, future, bolckingqueue or something) deadlock know? What do the multi-threaded data structures know? (say a semophore)
162and then the third brother asked the principle of the hashmap, it seems to be often asked.
1631. Give a string and output the char frequency. I started by asking all the lowercase letters and I did it with an array[26]. After that, I don’t know which characters are included in the input, so I use hashmap.
1642. Give the range and output the Fibonacci number column.
1653. 3Sum variant, summing the smallest but greater than the target combination
1664. Design questions: Each product has a corresponding list of recommended products, design a class to store, and ask to find the last recommended product list according to the input product ID (here, the output product has no recommended products). I thought about it and said that it would work like Trie, and the product[] in the product indicates the recommended list. Finally, write and write the key part of the code.
1675. Give a product a dependency and ask for a possible output order. (For example, the goods A, B, C, D, give [[A, B], [B, C], [C, D]]] A depends on B. The answer is to use the Topological sort, traverse it again. Save a map<String, String[]>, then a dependency int[], look for it from 0dependency. Finally, just write the key part.
168
169Make notes for projects
170Go through HR Doc
171Why Walmart
172Questions for interviewrs
173Query query = session.createQuery(“from Stock where stockCode = :code “);
174query.setParameter(“code”, “7277");
175List list = query.list();
176We have event driver microservices
177We use RabbitMQ as our messaging system. It’s responsible for distributing events to the services that listen for them. Tasks also go through RabbitMQ so it can balance load across multiple instances of an application
178We picked RabbitMQ because it was easy to deploy
179
180
181
182
183
1841. remove duplicate in linked list (write code)
1852. first non repeating char in string (code)
1862. First unique character in a stream
1873. Walmart List
1884. Top 145
1895. Sort linked list
1906. In the second technical round, I was expected to write down code for lowest common ancestor for binary tree as well as binary search tree on paper.
1917. Pascals trianle I & ii
1928. https://leetcode.com/problems/longest-consecutive-sequence/description/
1939. https://leetcode.com/problems/longest-increasing-subsequence/description/
19410. Least common ancestor + valid parenthesis + length of longest Fibonacci subsequence
19511. Simple binary tree left and right subtree inversion
19612. Amicable number
19713. Inorder tree traversal
19814. fizzbuzz
1994) Program to Implement queue using two stacks
200 5) Write a program to Sort version numbers
20115. stack using arraylist and linkedlist
202
203
204SQL, singleton mode, database basics.
205Remembered are HashMap, LinkedList, BST, Binary Search, ArrayList, JVM, Tree Traversal, BFS, DFS, Stack, Queue. . . . .
206
207JRE, Garbage Collector, Singleton, Wrapper class, stack memory vs heap Memory.
208Walmart : Last week, there was no result yet~~~ There were two interviewers who had a video session and talked for an hour. An interviewer introduced the situation in the group and asked a code. I forgot what question. But the difficulty of easy is very simple, you have to write on your own IDE, share screen to show him. The rest is another interviewer asked SQL, the basics of Machine Learning
209
210Asked the oop basics, hashmap vs hashtable, unexpectedly asked a lot of rest, spring had a problem, did not respond to it, did not expect him to ask what, and later thought that he should be asking notnull min and so on to check the input of the annotation. The coding asks for the difference between the minimum and maximum values in an array. The number entered by the followup is how to change the string, and directly converts the string into an integer. Overall, it feels very simple, but my interview experience is still very tight, and I am a good man.
211
212Sort linked list n long
213
214• Spring helps in the creation of loosely coupled applications because of Dependency Injection.
215• In Spring, objects define their associations (dependencies) and do not worry about how they will get those dependencies. It is the responsibility of Spring to provide the required dependencies for creating objects.
216For example: Suppose we have an object Employee and it has a dependency on object Address. We would define a bean corresponding to Employee that will define its dependency on object Address.
217When Spring tries to create an Employee object, it will see that Employee has a dependency on Address, so it will first create the Address object (dependent object) and then inject it into the Employee object.
218• Inversion of Control (IOC) and Dependency Injection (DI) are used interchangeably. IOC is achieved through DI. DI is the process of providing the dependencies and IOC is the end result of DI. (Note: DI is not the only way to achieve IOC. There are other ways as well.)
219• By DI, the responsibility of creating objects is shifted from our application code to the Spring container; this phenomenon is called IOC.
220• Dependency Injection can be done by setter injection or constructor injection.
221
222
223
224
225
226
227
228
229
230Twitter allows you to interact with its data i.e tweets and several other attributes using Twitter APIs. - Import Tweepy and import sparksteaming
231
232I have used tweepy in python to fetch the tweets.
233
234Kafka is a used for building real time data pipelines and streaming apps.
235Kafka stores streams of tweets in categories called topics.
236
237In Kafka, reach record has a key value and timestamp.
238key is the tweet id
239value is the tweet
240timestamp is when it was posted
241
242I have used 3 of Kafka has 3 APIs
243Producer, Consumer, Streams API
244
245Producer sends a msg to a kafka cluster(topics), consumer reads msgs from this topic.
246
247Kafka is free and useful for stream processing
248Start zookeeper for Kafka to work.
249Start kafka. Create a topic.
250Start producer console and Consumer console
251
252
253Spark is an open source processing engine built around speed and performance.
254
255
256Two python scripts,
257
258First script - it will prompt you to search for the word and number of tweets. All the tweets will be pushed to kafka topic using kafka producer.
259
260It will create a text file and output all tweets being read.
261
262Second script –
263This script reads the messages from the topics using the kafkautils.create directstream.
264Spark streaming will read these tweets in real time in a batch interval of 5secs.
265Each tweet will be split into words and using sentiwordnet in python, all these words are given a score.
266Scores of each word will be aggregated for a sentence.
267We will set a threshold for this score, based on the threshould it be classified as positive or negative.
268
269
270Run the second script before the first script, so that we are in a ready state to read the tweets as and when they come. Once that script is up and running we can run the first script.
271
272Kibana is used for viz. So we have created a bar chart, with positive and negative vs number of such tweets.