gewhiz / testRep

testing for the first Repository
2 stars 1 forks source link

glassdoor #2

Open gewhiz opened 9 years ago

gewhiz commented 9 years ago

Given a paragraph and line length, write a routine to justify words in the paragraph. Write a routine to find all collinear points in a plane. Constraint: The time complexity cannot be greater than O(n^2)

gewhiz commented 9 years ago

permuations

https://oj.leetcode.com/problems/search-in-rotated-sorted-array/

gewhiz commented 9 years ago

How would you design a URL shortener? =============================

gewhiz commented 9 years ago

A greedy interval scheduling problem

http://www.cs.rit.edu/~zjb/courses/800/lec8.pdf

gewhiz commented 9 years ago

find a list of unique IP address from a text file? ========================= http://stackoverflow.com/questions/14866578/get-all-ip-addresses-from-a-file-using-regex-java

gewhiz commented 9 years ago

all the combination of factors of one number http://stackoverflow.com/questions/15122437/print-all-unique-combination-of-factors-of-a-given-number

gewhiz commented 9 years ago

code a text justification routine (Given a line length insert white space so text is uniformly displayed within the given length). leetcode

Given a single-line text string and a maximum width value, write the function 'string justify(string text, int maxWidth)' that formats the input text using full-justification, i.e., extra spaces on each line are equally distributed between the words; the first word on each line is flushed left and the last word on each line is flushed right.

gewhiz commented 9 years ago

blocking thread safe queue http://codereview.stackexchange.com/questions/7002/java-blocking-queue http://blog.baozitraining.org/search/label/%E9%98%BB%E5%A1%9E%E9%98%9F%E5%88%97 http://en.wikipedia.org/wiki/Producer%E2%80%93consumer_problem

gewhiz commented 9 years ago

a deep iterator

Program an iterator for a Linked List which may include nodes which are nested within other nodes. i.e. (1)->(2)->(3(4))->((5)(6). Iterator returns 1->2->3->4->5->6

http://blog.baozitraining.org/2014/08/linkedin-twitter-and-hulu-onsite-how-to.html

gewhiz commented 9 years ago

public class BipartiteGraphs { public static void main(String[] args) { boolean[][] adj = new boolean[4][4]; adj[0][1] = true; adj[1][0] = true; adj[1][2] = true; adj[2][1] = true; adj[0][3] = true; adj[3][0] = true; adj[1][3]=true; adj[3][1]=true;

    System.out.println(check(adj));
}

public static boolean check(boolean[][] adj) {
    int[] colors = new int[adj.length];
    Queue<Integer> q = new LinkedList<Integer>();
    colors[0] = 1;
    q.add(0);
    while (!q.isEmpty()) {
        int t = q.poll();
        int expected;
        if (colors[t] == 1)
            expected = 2;
        else
            expected = 1;
        for (int i = 0; i < adj[t].length; i++) {
            if (adj[t][i]) {
                if (colors[i] != 0) {
                    if (colors[i] != expected)
                        return false;
                } else {
                    colors[i] = expected;
                    q.add(i);
                }
            }
        }
    }
    return true;
}

}

gewhiz commented 9 years ago

Design data structure to implement T9 dictionary

gewhiz commented 9 years ago

Design an Hangman. { They expect MVC architecture. } Design a scalable server for the hangman game battleship game ***

gewhiz commented 9 years ago

LRU cache

gewhiz commented 9 years ago

HashMap implementation Multi-thread

gewhiz commented 9 years ago

co-linear points in a plane

gewhiz commented 9 years ago

given like +77288.100, a772sb, 2000.00.11. return if it's a number. you could either write a regular expression or simply go through the string.

  1. it should start with "+/-" or "0-9".
  2. there should only have one "." in the string.
  3. all other character are "0-9"
gewhiz commented 9 years ago

implement a concurrent read-write buffer

gewhiz commented 9 years ago

load-balanced message queues, distributed hashmaps of sorted structs containing 5 URLs and their timestamps,

gewhiz commented 9 years ago

http://www.careercup.com/question?id=9941005

gewhiz commented 9 years ago

public interface Intervals { /**

}

gewhiz commented 9 years ago

Read in depth about the technologies that you have used so far, even though you haven't used it recently.

design a web calendar

gewhiz commented 9 years ago

ATOI conversion .

Write a function to determine if a string is an integer.

gewhiz commented 9 years ago

lowest common ancestor given two nodes

gewhiz commented 9 years ago

find the median of two sorted int arrays

gewhiz commented 9 years ago

replace all subarrays in an original array which match a given array, replace using another array. For example, we have: original array: "aaabbc" findarray: "bb" replaceArray: "ee" After running your function, it should be "aaaeec";

gewhiz commented 9 years ago

You need to distribute a terabyte of data from a single server to 10,000 nodes, and then keep that data up to date. It takes several hours to copy the data just to one server. How would you do this so that it didn't take 20,000 hours to update all the servers? Also, how would you make sure that the file wasn't corrupted during the copy?

gewhiz commented 9 years ago

Consider an X x Y array of 1's and 0s. The X axis represents "influences" meaning that X influences Y. So, for example, if $array[3,7] is 1 that means that 3 influences 7. An "influencer" is someone who influences every other person, but is not influenced by any other member. Given such an array, write a function to determine whether or not an "influencer" exists in the array.

gewhiz commented 9 years ago

design web crawler system

like load-balanced message queues, distributed hashmaps of sorted structs containing 5 URLs and their timestamps, and using LRU methods to GC the old data.

How would you design an enhancement to the LinkedIn homepage that displays 24-hour trailing lists (5-minute, 1-hour, 1-day) of the top 5 URLs that users post onto the site?

////Need to describe how to handle possible high volume concurrent submissions, how to store URLs, how to compute the trailing lists, and how to clean up stale data, all in the context of a load-balanced scalable architecture. //////////////// Given an interface called IntStream with methods 'bool hasNext()' and 'int next()', implement the function 'IntStream merge(IntStream[] streams)' where each input IntStream produces strictly increasing, possibly infinite number of, integers, and the resultant IntStream also produces strictly increasing integers by merging the input streams. The interviewer also provides a simple test harness that prints the first 5000 integers from that function.

gewhiz commented 9 years ago

Message queues

consider a B2C website like Amazon, which will receive thousands requests from buyer per minutes. How will you design the "shop cart " component for it? where should the customs' shop cart data stored==============================

gewhiz commented 9 years ago

In a given list of words, find matching words in the list that can be generated from the patterns of a given word.

gewhiz commented 9 years ago

How many instances of singleton can be in JVM?

gewhiz commented 9 years ago

co-linear points in a plane
implement a concurrent read-write buffer.

Implement Java Iterator interface in a question that requires a tree traversal-like algorithm. (get next!!!)

describe a machine learning method, how to deal with sparse data!!!!

gewhiz commented 9 years ago

What is List Comprehension? What's the difference between a list and a tuple.