6.12 notes

387. The first string a unique character: First, can () calculated using the number of occurrences of each collections.counter, then find key value == 1, and finally find () to find the element subscript. The second way without library functions, traversing from back to front, each time you view the element appears in the dictionary, and if not, to the first element added to the list p, and if so, for fear of the elements in the list p remove off before returning to p [-1]
389. Spot the difference: relatively simple a question, sorted two strings, one by one traverse, continued equal, not equal to the return value of a long string, if traversed short are not returned, returns the last of a long string.
134. stations: a traversal method, the vehicle can open the entire distance required to meet two conditions: (1) able to open the car from the station i to i + 1. The total amount of oil (2) to all stations in the> = the total fuel consumption of the car. So, start from the assumption numbered 0 station until k stations are normal, when bound k + 1 station car ran out of gas. In this case, the start point should be set to k + 1 stations

Guess you like

Origin blog.csdn.net/sinat_35325378/article/details/91491390