This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<profiles> | |
<profile> | |
<id>my-tests</id> | |
<build> | |
<plugins> | |
<plugin> | |
<artifactId>maven-failsafe-plugin</artifactId> | |
<configuration> | |
<excludes> | |
<exclude>**/stories/folder1/**</exclude> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static ListNode deleteDuplicates(ListNode head) { | |
if(head == null) return null; | |
ListNode fake = new ListNode(-1); | |
fake.next = head; | |
ListNode pre = fake; | |
ListNode cur = head; | |
while(cur != null){ | |
while(cur.next != null && cur.val == cur.next.val){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public V put(K key, V value) { | |
int hashCodeKey = hash(key); | |
return putVal(hashCodeKey, key, value); | |
} | |
private V putVal(int hashCodeKey, K key, V value) { | |
int newHashTableSize; | |
int indexForNode; | |
Node<K,V> nodeByHashCodeKey; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public V get(Object key) { | |
final int hashCodeForKey = hash(key); | |
final Node<K,V> nodeByKey = getNode(hashCodeForKey, key); | |
return nodeByKey == null ? null : nodeByKey.value; | |
} | |
private Node<K,V> getNode(int hashCodeKey, Object keySearch) { | |
Node<K,V> current; | |
Node<K,V> next; | |
K keyForNode; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class GoodKey { | |
private String a; | |
private String b; | |
public GoodKey(String a, String b) { | |
this.a = a; | |
this.b = b; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BadKey { | |
private String a; | |
private String b; | |
public BadKey(String a, String b) { | |
this.a = a; | |
this.b = b; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static ListNode getIntersectionNode(ListNode headA, ListNode headB) { | |
if(headA == null || headB == null){ | |
return null; | |
} | |
final Set<ListNode> nodesA = new HashSet<>(); | |
ListNode currentA = headA; | |
ListNode currentB = headB; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ListNode deleteDuplicates(ListNode head) { | |
if(head == null || head.next == null) | |
return head; | |
ListNode current = head; | |
while(current != null && current.next != null){ | |
if(current.val == current.next.val){ | |
current.next = current.next.next; | |
}else{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ListNode removeElements(ListNode head, int val) { | |
final ListNode fake = new ListNode(-1); | |
fake.next = head; | |
ListNode cur = fake; | |
while(cur.next != null){ | |
if(cur.next.val == val){ | |
cur.next = cur.next.next; | |
}else{ | |
cur = cur.next; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ListNode reverseBetween(ListNode head, int m, int n) { | |
if(head == null) | |
return null; | |
ListNode dummy = new ListNode(0); | |
dummy.next = head; | |
ListNode pre = dummy; | |
for(int i = 0; i < m-1; i++){ | |
pre = pre.next; | |
} |
OlderNewer