Written in front of the words-----
1: Brother to the watercress on the Leetcode on the topic of classification. http://www.douban.com/note/330562764/?qq-pf-to=pcqq.c2c
2: In Friday, the boss gave me a meeting and asked me 70 minutes for the things I had set up. But the conversion angle, this can urge oneself academic rigorous. The paper is on the one hand, the work is very important, like brother said the beginning can not give himself set goals too low, otherwise there will really be a low starting point. Here is the quote from brother:
Learn this kind of thing don't think you will not do this in the future do not learn.
First of all, you might actually do the technology.
Second, many things are connected.
The third thought is a habit
You give up once because of the difficulty, there must be a second time
Just because you are afraid, so afraid to do
Do on the line, or always idle in the hesitation to choose the fear.
Everyone around has a " luck" of the elves, they can bring good luck to the owner, just at the beginning, it may even help you resist the bad luck of the skill also did not, but touch every wall, encounter every setback, eat every loss, elves will silently swallowed. One day, it hit a burp, before all the pain will be turned into beautiful things appear.
Sometimes stress and prejudice often don't come from others. More is the need to tangle their prejudices, to recognize themselves.
All do not hands-on learning programming language is bullying.
Like Super Mario, eat a little mushroom, then jump to the flagpole to pull the flag, switch to a high-level scene and then trot the top mushrooms.
Come on, you can't kill!!
------------------------------------------------------------
This question and the sword refer to the section of the array on the surface of the question 3 is the same. The solution is the first and the upper right corner of the number comparison, if the number to find less than the upper right corner of the number, you can no longer compare the number of the column, if you want to find more than this number, then no longer compare this line. Each time a row or column is raised within the range of the array's look-up, it is scaled down until it finds the number to find, or the lookup range is empty.
In this problem, we first practiced the use of two-dimensional arrays in Java, and then practiced how to enter characters from the keyboard.
The following is the source of the problem:
public class Solution {
public static Boolean Searchmatrix (int[][] matrix, int target) {
int rows = Matrix.length;
int row = 0;
int columns = Matrix[0].length;
int column = Columns-1;
while (Row < rows&column>=0) {
if (target = = Matrix[row][column]) {
return true;
}
else{
if (Target < Matrix[row][column]) {
column--;
}
else{
row++;
}
}
}
return false;
}
public static void Main (string[] args) {
Scanner input = new Scanner (system.in);
SYSTEM.OUT.PRINTLN ("Please input rows");
int rows = Input.nextint ();
SYSTEM.OUT.PRINTLN ("Please input columns");
int columns = Input.nextint ();
int[][] Matrix = new Int[rows][columns];
for (int i = 0;i<rows;i++) {
for (int j = 0;j<columns;j++) {
SYSTEM.OUT.PRINTLN ("Please input:");
MATRIX[I][J] = Input.nextint ();
}
}
int target = 7;
Boolean s = Searchmatrix (Matrix,target);
System.out.println (s);
}
}
Blog for a long time did not write, refueling persist, I will continue to share my feelings here, as well as learn the things.
Search a 2D Matrix of Leetcode