Given an integer, if the number is prime, return 1. Otherwise return its smallest divisor greater than 1. e.g. if n = 24, its divisors are [1, 2, 3, 4, 6, 8, 12, 24]. The smallest divisor greater than 1 is 2.
Engineer Software Interview Questions
511,683 engineer software interview questions shared by candidates
Q: You are given two arrays of size m and n. Find the common elements between those arrays. Say, arr1 = {2, 5, 3} and arr2 = {5, 1, 2}. The common elements between those arrays are as follow: ans = {2, 5}
You have 2 jars and 50 black beads and 50 white beads. How many would you put of each color in each jar so that if a bead was randomly selected from both jars, you had the greatest chance they would match? You have to put all of the beads in the jars.
Tell me about yourself?
Write a function to multiply two arbitrarily large integers.
phone numbers: provided a phone number (654-876-0987), return all possible strings that the phone number could represent if 2 -> {A, B, C}, 3 -> {D, E, F}, and so on common substring: find the biggest common substring in 2 strings, "abcdef" "gbcdh" would return "bcd"
How do you find the kth smallest number in a binary search tree.
Regular expression and strStr. I was not able to give KMP algorithm to strStr
We have a log file, can grow pretty big. Each line is a trace-log, and the first field is the RequestID. We need to scan the file, and print all the logs for requests which resulted in error .. 001 <timestamp> BEGIN 001 <timestamp> fetched from db 001 <timestamp> some processing .. 002 <timestamp> BEGIN .. 002 <timestamp> fetched from db 001 <timestamp> returned success 003 <timestamp> BEGIN 001 <timestamp> END 003 <timestamp> some work 002 <timestamp> ERROR 003 <timestamp> some other work
Reverse an integer without using string operations.
Viewing 721 - 730 interview questions