Key topics

LeetCode  83. The deletion sort the list of repeating elements

Given a sorted list, delete all the duplicate elements, leaving only the original list does not duplicate elements.

 

LeetCode  maximum area 695. The island  's largest island problem (I thought of a divide and conquer, wrong ideas, direct explosion, the interviewer is good, to me for the questions)

Programming Question 2: 1 stock profits (also required to write test cases, requirements to run through)

Programming Problem 3: 2 stock returns (buy and sell multiple) (these two questions are seconds, the night before the interview just want to brush them dp title, brush these two questions, so that we think of what must go to school !!!)

Programming questions 1: 1 stock profits

Programming Question 2: 3 stock returns (buy and sell twice) (check the next, is the stock profits 3, hard)

Binary search, output index
19. The length of the array 10, the random numbers 0 to 9 and may be repeated to identify duplicate numbers, requires: time complexity of O (n), the spatial complexity is O (1); ( if someone would please stick to the comments section, thank you, note the time and space complexity)

public class Main{
    public static void main(String[] args) {
        int[] arr = {1,1,1,1,2,4,4,6,6,6};
        for (int i = 0; i < arr.length; i++) {
            int index = arr[i];
            if (index == i || index == -1){
                continue;
            }else if (index != arr[index] && arr[index] != -1){
                int tmp = arr[i];
                arr[i] = arr[index];
                ARR [index] =tmp; 
                I - ; 
            } the else  IF (index == ARR [index]) { 
                of System.out.print (index + "" ); 
                ARR [index] = -1; // prevented as {3, such output 3,3} 33 
            } 
        } 
    } 
}

Comparison of sorting algorithms, complexity, stability

 LeetCode  138. Copy pointer list with Random

Algorithm Title: k is the size divided by the list soon, the block list will be reversed

Algorithm title

  • Gives a = 1, b = 2, ..., z = 26 such a coding, to ask how many such cases the composition 126 (speaking ideas)

  • Can only hold a stock of maximum benefit is how much stock trading

. Talk about sorting algorithms know what? How much time complexity is? The best case is how much? The worst case is how much?

Arithmetic problem, given a precision square root of a number

Algorithms question: Flip string of words: such as "how are you" becomes "you are how"

There are a total of two five three kinds of coins to make up 100 yuan ask how much is the minimum number of coins? (Dynamic programming)

Write questions:
Write a binary tree depth of recursion
Static inner classes

9. Write a title integer division, can not be used except No.

Write a program to copy a string
17, the wording of the proposed norms and everywhere else improved (written too much food, not standardized, despised the interviewer laugh)

 

Puzzles

You have 1000 bottles of drinks, including a bottle of poisonous, you have a lot of rats, mice 24 hours after drinking the beverage will die, on average, how many days would you find this poisonous drink? How many mice need?
5. Do you have 1000 mana, there are four skills, skills, values ​​and hurt consumption is proportional to the value of magic, I ask you how to use skills in order to achieve maximum damage output?
6. Daguai have a 80% probability of falling equipment, 20% probability of falling B equipment, ask the average person fight a few times strange, before they can cobble together ab equipment? (This question I can not hope to have big brother to help me answer)

Guess you like

Origin www.cnblogs.com/youngao/p/12596646.html