g0801_0900.s0855_exam_room.Node Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of leetcode-in-java Show documentation
Show all versions of leetcode-in-java Show documentation
Java-based LeetCode algorithm problem solutions, regularly updated
package g0801_0900.s0855_exam_room;
import java.util.Map;
class Node {
Node pre;
Node next;
int val;
Node(int val, Map map) {
this.val = val;
map.put(val, this);
}
int insert(Node left) {
Node right = left.next;
left.next = this;
right.pre = this;
this.next = right;
this.pre = left;
return val;
}
void delete() {
Node left = this.pre;
Node right = this.next;
left.next = right;
right.pre = left;
}
}