pull/6/head
yuanguangxin 5 years ago
parent d4dc36a4c9
commit 89d3a85238

@ -2,11 +2,10 @@
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="af7ffdf2-4ddc-4ed6-8222-60ed5acbc2ed" name="Default Changelist" comment=""> <list default="true" id="af7ffdf2-4ddc-4ed6-8222-60ed5acbc2ed" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/src/链表操作/q138_复制带随机指针的链表/f1/Node.java" afterDir="false" /> <change afterPath="$PROJECT_DIR$/src/区间合并/q56_合并区间/Solution.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/链表操作/q138_复制带随机指针的链表/f1/Solution.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/链表操作/q138_复制带随机指针的链表/f2/Node.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/链表操作/q138_复制带随机指针的链表/f2/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$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Rocket.md" beforeDir="false" afterPath="$PROJECT_DIR$/Rocket.md" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -65,7 +64,7 @@
<property name="project.structure.last.edited" value="Modules" /> <property name="project.structure.last.edited" value="Modules" />
<property name="project.structure.proportion" value="0.15" /> <property name="project.structure.proportion" value="0.15" />
<property name="project.structure.side.proportion" value="0.2" /> <property name="project.structure.side.proportion" value="0.2" />
<property name="settings.editor.selected.configurable" value="Errors" /> <property name="settings.editor.selected.configurable" value="MavenSettings" />
</component> </component>
<component name="RecentsManager"> <component name="RecentsManager">
<key name="CopyClassDialog.RECENTS_KEY"> <key name="CopyClassDialog.RECENTS_KEY">
@ -280,7 +279,7 @@
<workItem from="1582286924766" duration="554000" /> <workItem from="1582286924766" duration="554000" />
<workItem from="1582552791282" duration="3963000" /> <workItem from="1582552791282" duration="3963000" />
<workItem from="1582634245000" duration="13006000" /> <workItem from="1582634245000" duration="13006000" />
<workItem from="1582873496305" duration="5352000" /> <workItem from="1582873496305" duration="7292000" />
</task> </task>
<task id="LOCAL-00001" summary="add q5/q7/q172"> <task id="LOCAL-00001" summary="add q5/q7/q172">
<created>1580045439607</created> <created>1580045439607</created>
@ -569,7 +568,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1582888928990</updated> <updated>1582888928990</updated>
</task> </task>
<option name="localTasksCounter" value="42" /> <task id="LOCAL-00042" summary="add q138">
<created>1582901003378</created>
<option name="number" value="00042" />
<option name="presentableId" value="LOCAL-00042" />
<option name="project" value="LOCAL" />
<updated>1582901003378</updated>
</task>
<option name="localTasksCounter" value="43" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
@ -622,7 +628,6 @@
</option> </option>
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value="add q21" />
<MESSAGE value="add q26/q43" /> <MESSAGE value="add q26/q43" />
<MESSAGE value="add q46" /> <MESSAGE value="add q46" />
<MESSAGE value="add q53" /> <MESSAGE value="add q53" />
@ -647,7 +652,8 @@
<MESSAGE value="add q141/q202/q258" /> <MESSAGE value="add q141/q202/q258" />
<MESSAGE value="更新分类目录" /> <MESSAGE value="更新分类目录" />
<MESSAGE value="面试题目更新" /> <MESSAGE value="面试题目更新" />
<option name="LAST_COMMIT_MESSAGE" value="面试题目更新" /> <MESSAGE value="add q138" />
<option name="LAST_COMMIT_MESSAGE" value="add q138" />
</component> </component>
<component name="WindowStateProjectService"> <component name="WindowStateProjectService">
<state x="320" y="115" key="#Inspections" timestamp="1581061018990"> <state x="320" y="115" key="#Inspections" timestamp="1581061018990">
@ -662,10 +668,10 @@
<screen x="0" y="0" width="1440" height="900" /> <screen x="0" y="0" width="1440" height="900" />
</state> </state>
<state x="533" y="166" key="#com.intellij.ide.util.MemberChooser/0.0.1440.900@0.0.1440.900" timestamp="1578548165321" /> <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="1582900985108"> <state x="303" y="50" key="CommitChangelistDialog2" timestamp="1582901003112">
<screen x="0" y="0" width="1440" height="900" /> <screen x="0" y="0" width="1440" height="900" />
</state> </state>
<state x="303" y="50" key="CommitChangelistDialog2/0.0.1440.900@0.0.1440.900" timestamp="1582900985108" /> <state x="303" y="50" key="CommitChangelistDialog2/0.0.1440.900@0.0.1440.900" timestamp="1582901003112" />
<state x="144" y="78" width="1152" height="720" key="DiffContextDialog" timestamp="1582900981690"> <state x="144" y="78" width="1152" height="720" key="DiffContextDialog" timestamp="1582900981690">
<screen x="0" y="0" width="1440" height="900" /> <screen x="0" y="0" width="1440" height="900" />
</state> </state>
@ -712,14 +718,14 @@
</state> </state>
<state width="1398" height="204" key="GridCell.Tab.1.right/0.0.1440.900@0.0.1440.900" timestamp="1581745235894" /> <state width="1398" height="204" key="GridCell.Tab.1.right/0.0.1440.900@0.0.1440.900" timestamp="1581745235894" />
<state width="1398" height="304" key="GridCell.Tab.1.right/0.23.1440.797@0.23.1440.797" timestamp="1580408030266" /> <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"> <state x="221" y="63" key="SettingsEditor" timestamp="1582961080628">
<screen x="0" y="0" width="1440" height="900" /> <screen x="0" y="0" width="1440" height="900" />
</state> </state>
<state x="221" y="63" key="SettingsEditor/0.0.1440.900@0.0.1440.900" timestamp="1581061096545" /> <state x="221" y="63" key="SettingsEditor/0.0.1440.900@0.0.1440.900" timestamp="1582961080628" />
<state x="320" y="190" key="Vcs.Push.Dialog.v2" timestamp="1582888930786"> <state x="320" y="190" key="Vcs.Push.Dialog.v2" timestamp="1582901004760">
<screen x="0" y="0" width="1440" height="900" /> <screen x="0" y="0" width="1440" height="900" />
</state> </state>
<state x="320" y="190" key="Vcs.Push.Dialog.v2/0.0.1440.900@0.0.1440.900" timestamp="1582888930786" /> <state x="320" y="190" key="Vcs.Push.Dialog.v2/0.0.1440.900@0.0.1440.900" timestamp="1582901004760" />
<state x="100" y="100" width="1240" height="700" key="com.intellij.history.integration.ui.views.DirectoryHistoryDialog" timestamp="1581744794182"> <state x="100" y="100" width="1240" height="700" key="com.intellij.history.integration.ui.views.DirectoryHistoryDialog" timestamp="1581744794182">
<screen x="0" y="23" width="1440" height="797" /> <screen x="0" y="23" width="1440" height="797" />
</state> </state>

@ -9,8 +9,8 @@
### 链表操作 ### 链表操作
* [q2_两数相加](/src/链表操作/q2_两数相加) * [q2_两数相加](/src/链表操作/q2_两数相加)
* [q206_反转链表](/src/链表操作/q206_反转链表)
* [q138_复制带随机指针的链表](/src/链表操作/q138_复制带随机指针的链表) * [q138_复制带随机指针的链表](/src/链表操作/q138_复制带随机指针的链表)
* [q206_反转链表](/src/链表操作/q206_反转链表)
### 双指针遍历/滑动窗口 ### 双指针遍历/滑动窗口
@ -53,6 +53,10 @@
* [q20_有效的括号](/src/栈操作/q20_有效的括号) * [q20_有效的括号](/src/栈操作/q20_有效的括号)
* [q224_基本计算器](/src/栈操作/q224_基本计算器) * [q224_基本计算器](/src/栈操作/q224_基本计算器)
### 区间合并
* [q56_合并区间](/src/区间合并/q56_合并区间)
### 递归 ### 递归
* [q21_合并两个有序链表](/src/递归/q21_合并两个有序链表) * [q21_合并两个有序链表](/src/递归/q21_合并两个有序链表)

@ -507,7 +507,7 @@ Kafka最初考虑的问题是customer应该从brokes拉取消息还是brokers
### 进程的组成部分 ### 进程的组成部分
进程由进程控制块、程序段、数据段三部分组成。 进程由进程控制块PCB、程序段、数据段三部分组成。
### 进程的通信方式 ### 进程的通信方式

@ -0,0 +1,37 @@
package .q56_;
import java.util.*;
/**
* startmerge o(n*log(n))
*/
class Solution {
public int[][] merge(int[][] intervals) {
if(intervals.length <= 1){
return intervals;
}
Arrays.sort(intervals, Comparator.comparingInt(arr -> arr[0]));
int[] currInterval = intervals[0];
List<int[]> resArr = new ArrayList<>();
resArr.add(currInterval);
for(int[] interval: intervals){
int currEnd = currInterval[1];
int nextBegin = interval[0];
int nextEnd = interval[1];
if(currEnd >= nextBegin){
currInterval[1] = Math.max(currEnd, nextEnd);
} else{
currInterval = interval;
resArr.add(currInterval);
}
}
return resArr.toArray(new int[resArr.size()][]);
}
}
Loading…
Cancel
Save