Skip to content

Commit

Permalink
Issue cognizance-amrita#84 : Resolve in python
Browse files Browse the repository at this point in the history
resolves cognizance-amrita#84 Delete_a_node in python & java
  • Loading branch information
jaichiranjeeva committed Oct 24, 2022
1 parent 61431b1 commit b6c7a2c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
20 changes: 20 additions & 0 deletions java/Delete_a_node.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import java.util.Scanner;

public class Delete_a_node{
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
int len=in.nextInt(),l,i;
int[] list=new int[len];
int[] rem=new int[len-1];
for( i=0;i<len;i++){
list[i]=in.nextInt();
}
int rem_ind=in.nextInt();
for ( i=0, l=0;i<len;i++){
if(i!=rem_ind)
rem[l++]=list[i];
}
for(i=0;i<len-1;i++)
System.out.print(rem[i]+" ");
}
}
7 changes: 7 additions & 0 deletions python/Delete_a_node.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
lim=int(input())
l=[]
while(lim):
l.append(int(input()))
lim=lim-1
l.pop(int(input()))
print(l)

0 comments on commit b6c7a2c

Please sign in to comment.