Skip to main content

All Questions

Filter by
Sorted by
Tagged with
6 votes
4 answers
952 views

Counting the number of patterns that exist in a particular string

I am solving this problem where the function returns the number of times a pattern is found in a said string word. It could be easily solved via ...
xyf's user avatar
  • 508
2 votes
2 answers
674 views

Class name search algorithm

Here is a test task from a company, where I'd like to work eventually. I solved all they wanted to me to do, however failed to get an interview. I do not know what is wrong with my solution, because ...
Eli. G's user avatar
  • 23
6 votes
3 answers
321 views

Interview coding test: Searcher

I did a task for an interview and the solution was not accepted. The task was to implement the class search function by name. The number of classes in the input data from 0 to 100000. Class names are ...
kovareka's user avatar
30 votes
8 answers
50k views

Find all the missing number(s)

Recently I've attended an interview, where I faced the below question: Question: "There is an sorted array. You need to find all the missing numbers. Write the complete code, without using any ...
Gokul Nath KP's user avatar
7 votes
3 answers
5k views

Searching in a sorted 2D matrix

If I was at an interview, and wrote this code, what would you think? Please be brutal. Time it took to wrote it: 13 minutes Problem: Write an efficient algorithm that searches for a value in an m x n ...
bazang's user avatar
  • 2,236
9 votes
3 answers
4k views

Extracting elements from multiple sorted lists efficiently

I was asked this interview question recently. I was able to come up with this which runs in \$O(k \log n)\$. Given k <= n sorted arrays each of size n, there exists a data structure requiring \$...
david's user avatar
  • 1,947
53 votes
12 answers
23k views

Searching in an array in less than O(n) time

I have an array where each element is either one less or one greater than the preceding element \$\{x_i = x_{i-1} \pm 1\}\$. I wish to find an element in it in less than \$O(n)\$ time. I've ...
user3011937's user avatar
17 votes
7 answers
143k views

Finding repeating numbers in an array

I want to search through an array of n numbers and find the numbers that are repeated. So far I have this code, which does the job, but I find it to be a rather cumbersome method, but I can't seem to ...
Hatori Sanso's user avatar
156 votes
20 answers
32k views

Searching an element in a sorted array

I was applying for a position, and they asked me to complete a coding problem for them. I did so and submitted it, but I later found out I was rejected from the position. Anyways, I have an eclectic ...
user avatar