Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b50539e

Browse files
binarysearch.io problem
1 parent 4967419 commit b50539e

File tree

6 files changed

+50
-3
lines changed

6 files changed

+50
-3
lines changed

‎.~lock.Collections Notes.odt#‎

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/**
2+
* class LLNode {
3+
* int val;
4+
* LLNode next;
5+
* }
6+
*/
7+
8+
import java.util.*;
9+
10+
class InsertIntoLinkedList {
11+
public LLNode solve(LLNode head, int pos, int val) {
12+
13+
if(pos==0)
14+
{
15+
LLNode new_node = new LLNode(val,head);
16+
return new_node;
17+
}
18+
else{
19+
LLNode new_node = new LLNode(val);
20+
LLNode pointer = head;
21+
for(int i=0;i<pos-1;i++)
22+
{
23+
pointer= pointer.next;
24+
25+
}
26+
new_node.next=pointer.next;
27+
pointer.next = new_node;
28+
29+
}
30+
return head;
31+
}
32+
}
33+
34+
// class Solution {
35+
// public LLNode solve(LLNode head, int pos, int val) {
36+
// if (pos == 0) {
37+
// LLNode ans = new LLNode(val, head);
38+
// return ans;
39+
// }
40+
// LLNode temp = head;
41+
// while (pos > 1) {
42+
// temp = temp.next;
43+
// pos--;
44+
// }
45+
// temp.next = new LLNode(val, temp.next);
46+
// return head;
47+
// }
48+
// }

‎testJava/chefada.class‎

717 Bytes
Binary file not shown.

‎testJava/chefada.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
packagetestJava;
1+
22
import java.util.*;
33

44
public class chefada {

‎testJava/chefinaswap.class‎

1.37 KB
Binary file not shown.

‎testJava/chefinaswap.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ public static void main(String[] args) throws Exception{
204204
else:
205205
ans += c[i][0]
206206
print(ans)*/
207-
packagetestJava;
207+
208208

209209
import java.util.Scanner;
210210
import java.util.*;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /