Topic:
1. Determine whether a number is a power of 3.
2. Determine whether a number is a power of 3, without loops or recursion.
3. The regular expression is used to match the phone number.
Example: (020) 12345678
020-12345678
There is also a regular expression that determines whether it can be matched to cc.163.com.
4. The browser enters a URL and what happens?
5. Enter the date of the month and seconds, give the next second time, such as December 31, 2004 23:59 59 seconds, Output January 1, 2005 0:0 0 seconds.
void Nextsecond (int *nyear,int *nmonth,int *ndate,int *nhour,int *nminute,int *nsecond);
6. The database has the table person, save the ID and email two column information, use the SELECT statement to find duplicate email.
7. Convert the decimal number between 0~3999 to a Roman numeral representation. (i,v,x,d,l,c,m)
8. Enter an integer that determines the number of binary numbers from 0 to the integer 1. Returns an array.
9. Programming Questions: Implement the constructor of the string class, copy constructors, destructors, and assignment (equal-value overloading) functions.
10. Programming Questions: Enter three strings per line to determine if the order of characters in the third string matches the first second string. such as: ABC def ABDEFC
11. Fill in the blanks: what is ptr in int (*ptr) ()?
12. Fill in the blanks: 32-bit computer int a[3][4], ask sizeof (a) =?
13. Give 11 numbers: 1,2,12,8,9,10,4,5,6,7,11, what is a balanced binary tree?
14. Fill in the blanks: what is the difference between stacks and queues?
15. Determine if a float-type variable x is an expression of 0?
A cursory look at the next, 15 questions, almost can do general, algorithm problems, general difficulty, regular expression matching did not contact me, no thoughts. The database of the problem is very basic, but also do not remember. 0.0
Exercises
2. This is Leetcode 326. Power of three A problem without loops and recursion.
Ceil (x) returns the smallest integer value not less than X (then converted to type Double).
Floor (x) returns the maximum integer value that is less than X.
Round (x) returns the rounded integer value of x.
#include"iostream"#include"math.h"using namespacestd;intMain () { while(true) { intN; CIN>>N; DoubleAns = log (n)/log (3); if(Floor (ans) = =ceil (ans)) cout<<"YES"<<Endl; Elsecout<<"NO"<<Endl; //Abs (Ans-round (ANS)) < 1e-10 can also be } }
If it is judged 2, 4, available shift operation, right shift >>1.
Or, 2 of the N-square, 2 in the binary must be only one 1, and not at the right-most,n& (n-1) ==0
4. The following is an approximate process:
- The browser looks for the IP address that corresponds to the input URL to the DNS server.
- The DNS server returns the IP address of the Web site.
- The browser establishes a TCP connection on port 80 based on the IP address and the destination Web server
- The browser gets the HTML code for the requested page.
- The browser renders the HTML within the Display window.
- When the window is closed, the browser terminates the connection to the server.
The most interesting of these is the 1th and 2nd steps (domain name resolution). We enter the URL (domain name) is an alias of the IP address, within a DNS, a domain name corresponding to an IP address. The Domain Name System (DNS) works by matching the domain name with its IP address. DNS is distributed and has hierarchical relationships.
Although a domain name server only records a small subnet host name and IP address, but all the domain name server to work together, you can be the entire network domain name and their IP address. This means that if a domain name server cannot find the IP address of a request domain name, it will make a request to the other domain name server to look for.
NetEase CC Research Engineer Pen question 2016-04-15