Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit b272674

Browse files
committed
update
1 parent c68af7d commit b272674

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package Grind169.LinkedLists;
2+
3+
public class SwapNodesInPairs_24 {
4+
public class ListNode {
5+
int val;
6+
ListNode next;
7+
ListNode() {}
8+
ListNode(int val) { this.val = val; }
9+
ListNode(int val, ListNode next) { this.val = val; this.next = next; }
10+
}
11+
12+
public static void main(String[] args) {
13+
14+
}
15+
16+
public static ListNode swapPairs(ListNode head) {
17+
ListNode temp;
18+
if(head ==null ){
19+
return null;
20+
}else if(head != null && head.next ==null){
21+
return head;
22+
}else{
23+
temp=head.next;
24+
head.next=temp.next;
25+
temp.next=head;
26+
head=temp;
27+
head.next.next= swapPairs(head.next.next);
28+
return head;
29+
}
30+
}
31+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package Grind169.Stacks;
2+
3+
import java.util.Scanner;
4+
import java.util.Stack;
5+
6+
public class BackSpaceStringCompare_844 {
7+
public static void main(String[] args) {
8+
Scanner kbr= new Scanner(System.in);
9+
System.out.println("Type 1st string: ");
10+
String s = kbr.nextLine();
11+
System.out.println("Enter 2nd String: ");
12+
String t= kbr.nextLine();
13+
14+
boolean check= backspaceCompare(s, t);
15+
System.out.println(check);
16+
}
17+
18+
public static boolean backspaceCompare(String s, String t) {
19+
20+
}
21+
}

0 commit comments

Comments
 (0)