pull/6/head
yuanguangxin 5 years ago
parent d581ca1a4c
commit f2064cbc45

@ -1,14 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="af7ffdf2-4ddc-4ed6-8222-60ed5acbc2ed" name="Default Changelist" comment="update q98">
<change afterPath="$PROJECT_DIR$/src/q110/Solution.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/q110/TreeNode.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/q450/Solution.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/q450/TreeNode.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/q701/Solution.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/q701/TreeNode.java" afterDir="false" />
<list default="true" id="af7ffdf2-4ddc-4ed6-8222-60ed5acbc2ed" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/src/q1277/Solution.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Rocket.md" beforeDir="false" afterPath="$PROJECT_DIR$/Rocket.md" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -83,7 +79,7 @@
<recent name="$PROJECT_DIR$/src/q206/f1" />
</key>
</component>
<component name="RunManager" selected="Application.Solution (2)">
<component name="RunManager" selected="Application.Solution (3)">
<configuration name="Main" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="etc.tree.traversal.Main" />
<module name="LeetCode" />
@ -123,12 +119,12 @@
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="Solution (4)" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="q144.Solution" />
<configuration name="Solution (3)" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="q1277.Solution" />
<module name="LeetCode" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="q144.*" />
<option name="PATTERN" value="q1277.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
@ -177,11 +173,11 @@
</configuration>
<recent_temporary>
<list>
<item itemvalue="Application.Solution (3)" />
<item itemvalue="Application.Solution (2)" />
<item itemvalue="Application.Solution" />
<item itemvalue="Application.Solution (1)" />
<item itemvalue="Application.Main" />
<item itemvalue="Application.Solution (4)" />
</list>
</recent_temporary>
</component>
@ -222,7 +218,7 @@
<workItem from="1580044287086" duration="50376000" />
<workItem from="1580562331089" duration="8289000" />
<workItem from="1580626297484" duration="35811000" />
<workItem from="1581061282899" duration="36747000" />
<workItem from="1581061282899" duration="41783000" />
</task>
<task id="LOCAL-00001" summary="add q5/q7/q172">
<created>1580045439607</created>
@ -315,7 +311,14 @@
<option name="project" value="LOCAL" />
<updated>1581156795852</updated>
</task>
<option name="localTasksCounter" value="14" />
<task id="LOCAL-00014" summary="add q110/q450/q701">
<created>1581270301073</created>
<option name="number" value="00014" />
<option name="presentableId" value="LOCAL-00014" />
<option name="project" value="LOCAL" />
<updated>1581270301073</updated>
</task>
<option name="localTasksCounter" value="15" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@ -335,7 +338,8 @@
<MESSAGE value="add q23/q101" />
<MESSAGE value="add q94/98/144/145" />
<MESSAGE value="update q98" />
<option name="LAST_COMMIT_MESSAGE" value="update q98" />
<MESSAGE value="add q110/q450/q701" />
<option name="LAST_COMMIT_MESSAGE" value="add q110/q450/q701" />
</component>
<component name="WindowStateProjectService">
<state x="320" y="115" key="#Inspections" timestamp="1581061018990">
@ -350,62 +354,62 @@
<screen x="0" y="0" width="1440" height="900" />
</state>
<state x="533" y="166" key="#com.intellij.ide.util.MemberChooser/0.0.1440.900@0.0.1440.900" timestamp="1578548165321" />
<state x="303" y="50" key="CommitChangelistDialog2" timestamp="1581156819540">
<state x="303" y="50" key="CommitChangelistDialog2" timestamp="1581270300737">
<screen x="0" y="0" width="1440" height="900" />
</state>
<state x="303" y="50" key="CommitChangelistDialog2/0.0.1440.900@0.0.1440.900" timestamp="1581156819540" />
<state x="303" y="50" key="CommitChangelistDialog2/0.0.1440.900@0.0.1440.900" timestamp="1581270300737" />
<state x="144" y="78" key="DiffContextDialog" timestamp="1581156782199">
<screen x="0" y="0" width="1440" height="900" />
</state>
<state x="144" y="78" key="DiffContextDialog/0.0.1440.900@0.0.1440.900" timestamp="1581156782199" />
<state width="1398" height="286" key="GridCell.Tab.0.bottom" timestamp="1581264516470">
<screen x="0" y="23" width="1440" height="797" />
<state width="1398" height="144" key="GridCell.Tab.0.bottom" timestamp="1581441518770">
<screen x="0" y="0" width="1440" height="900" />
</state>
<state width="1398" height="204" key="GridCell.Tab.0.bottom/0.0.1440.900@0.0.1440.900" timestamp="1581264453065" />
<state width="1398" height="144" key="GridCell.Tab.0.bottom/0.0.1440.900@0.0.1440.900" timestamp="1581441518770" />
<state width="1398" height="286" key="GridCell.Tab.0.bottom/0.23.1440.797@0.23.1440.797" timestamp="1581264516470" />
<state width="1398" height="286" key="GridCell.Tab.0.center" timestamp="1581264516465">
<screen x="0" y="23" width="1440" height="797" />
<state width="1398" height="144" key="GridCell.Tab.0.center" timestamp="1581441518768">
<screen x="0" y="0" width="1440" height="900" />
</state>
<state width="1398" height="204" key="GridCell.Tab.0.center/0.0.1440.900@0.0.1440.900" timestamp="1581264453062" />
<state width="1398" height="144" key="GridCell.Tab.0.center/0.0.1440.900@0.0.1440.900" timestamp="1581441518768" />
<state width="1398" height="286" key="GridCell.Tab.0.center/0.23.1440.797@0.23.1440.797" timestamp="1581264516465" />
<state width="1398" height="286" key="GridCell.Tab.0.left" timestamp="1581264516457">
<screen x="0" y="23" width="1440" height="797" />
<state width="1398" height="144" key="GridCell.Tab.0.left" timestamp="1581441518767">
<screen x="0" y="0" width="1440" height="900" />
</state>
<state width="1398" height="204" key="GridCell.Tab.0.left/0.0.1440.900@0.0.1440.900" timestamp="1581264453061" />
<state width="1398" height="144" key="GridCell.Tab.0.left/0.0.1440.900@0.0.1440.900" timestamp="1581441518767" />
<state width="1398" height="286" key="GridCell.Tab.0.left/0.23.1440.797@0.23.1440.797" timestamp="1581264516457" />
<state width="1398" height="286" key="GridCell.Tab.0.right" timestamp="1581264516469">
<screen x="0" y="23" width="1440" height="797" />
<state width="1398" height="144" key="GridCell.Tab.0.right" timestamp="1581441518769">
<screen x="0" y="0" width="1440" height="900" />
</state>
<state width="1398" height="204" key="GridCell.Tab.0.right/0.0.1440.900@0.0.1440.900" timestamp="1581264453063" />
<state width="1398" height="144" key="GridCell.Tab.0.right/0.0.1440.900@0.0.1440.900" timestamp="1581441518769" />
<state width="1398" height="286" key="GridCell.Tab.0.right/0.23.1440.797@0.23.1440.797" timestamp="1581264516469" />
<state width="1398" height="204" key="GridCell.Tab.1.bottom" timestamp="1581264453067">
<state width="1398" height="204" key="GridCell.Tab.1.bottom" timestamp="1581311721264">
<screen x="0" y="0" width="1440" height="900" />
</state>
<state width="1398" height="204" key="GridCell.Tab.1.bottom/0.0.1440.900@0.0.1440.900" timestamp="1581264453067" />
<state width="1398" height="204" key="GridCell.Tab.1.bottom/0.0.1440.900@0.0.1440.900" timestamp="1581311721264" />
<state width="1398" height="304" key="GridCell.Tab.1.bottom/0.23.1440.797@0.23.1440.797" timestamp="1580408030266" />
<state width="1398" height="204" key="GridCell.Tab.1.center" timestamp="1581264453066">
<state width="1398" height="204" key="GridCell.Tab.1.center" timestamp="1581311721263">
<screen x="0" y="0" width="1440" height="900" />
</state>
<state width="1398" height="204" key="GridCell.Tab.1.center/0.0.1440.900@0.0.1440.900" timestamp="1581264453066" />
<state width="1398" height="204" key="GridCell.Tab.1.center/0.0.1440.900@0.0.1440.900" timestamp="1581311721263" />
<state width="1398" height="304" key="GridCell.Tab.1.center/0.23.1440.797@0.23.1440.797" timestamp="1580408030265" />
<state width="1398" height="204" key="GridCell.Tab.1.left" timestamp="1581264453066">
<state width="1398" height="204" key="GridCell.Tab.1.left" timestamp="1581311721262">
<screen x="0" y="0" width="1440" height="900" />
</state>
<state width="1398" height="204" key="GridCell.Tab.1.left/0.0.1440.900@0.0.1440.900" timestamp="1581264453066" />
<state width="1398" height="204" key="GridCell.Tab.1.left/0.0.1440.900@0.0.1440.900" timestamp="1581311721262" />
<state width="1398" height="304" key="GridCell.Tab.1.left/0.23.1440.797@0.23.1440.797" timestamp="1580408030262" />
<state width="1398" height="204" key="GridCell.Tab.1.right" timestamp="1581264453067">
<state width="1398" height="204" key="GridCell.Tab.1.right" timestamp="1581311721263">
<screen x="0" y="0" width="1440" height="900" />
</state>
<state width="1398" height="204" key="GridCell.Tab.1.right/0.0.1440.900@0.0.1440.900" timestamp="1581264453067" />
<state width="1398" height="204" key="GridCell.Tab.1.right/0.0.1440.900@0.0.1440.900" timestamp="1581311721263" />
<state width="1398" height="304" key="GridCell.Tab.1.right/0.23.1440.797@0.23.1440.797" timestamp="1580408030266" />
<state x="221" y="63" key="SettingsEditor" timestamp="1581061096545">
<screen x="0" y="0" width="1440" height="900" />
</state>
<state x="221" y="63" key="SettingsEditor/0.0.1440.900@0.0.1440.900" timestamp="1581061096545" />
<state x="320" y="190" key="Vcs.Push.Dialog.v2" timestamp="1581156797100">
<state x="320" y="190" key="Vcs.Push.Dialog.v2" timestamp="1581270302645">
<screen x="0" y="0" width="1440" height="900" />
</state>
<state x="320" y="190" key="Vcs.Push.Dialog.v2/0.0.1440.900@0.0.1440.900" timestamp="1581156797100" />
<state x="320" y="190" key="Vcs.Push.Dialog.v2/0.0.1440.900@0.0.1440.900" timestamp="1581270302645" />
<state x="378" y="207" width="683" height="486" key="find.popup" timestamp="1581148315369">
<screen x="0" y="0" width="1440" height="900" />
</state>

@ -507,7 +507,7 @@ TCP是一个双向通信协议通信双方都有能力发送信息并接
(2)选择排序:选择排序与冒泡排序有点像,只不过选择排序每次都是在确定了最小数的下标之后再进行交换,大大减少了交换的次数
(3)插入排序将一个记录插入到已排序的有序表中从而得到一个新的记录数增1的有序表
(4)快速排序:通过一趟排序将序列分成左右两部分,其中左半部分的的值均比右半部分的值小,然后再分别对左右部分的记录进行排序,直到整个序列有序。
```c
```
int partition(int a[], int low, int high){
int key = a[low];
while( low < high ){

@ -0,0 +1,37 @@
package q1277;
/**
* dp[i][j] matrix[i][j] o(n^2)
*/
public class Solution {
public int countSquares(int[][] matrix) {
if (matrix.length < 1) {
return 0;
}
int m = matrix.length;
int n = matrix[0].length;
int[][] dp = new int[m][n];
int rs = 0;
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
if (matrix[i][j] == 0) {
dp[i][j] = 0;
} else {
if (i > 0 && j > 0) {
dp[i][j] = Math.min(Math.min(dp[i - 1][j], dp[i][j - 1]), dp[i - 1][j - 1]) + 1;
} else {
dp[i][j] = 1;
}
rs += dp[i][j];
}
}
}
return rs;
}
public static void main(String[] args) {
new Solution().countSquares(new int[][]{{0, 1, 1, 1}, {1, 1, 1, 1}, {0, 1, 1, 1}});
}
}
Loading…
Cancel
Save