Tip 1 : Be very clear with your project explanation.
Tip 2 : Also try to cover all the cs core subjects explanation clearly.
Tip 1:Make it clean with appropriate kowledge.
Tip 2:Provide true information and avoid telling lie in which You are not sure.
It was morning time and from 9:00 am . It happened via the google meet online process and it was very smooth onboarding . Interviewer was very friendly kind of nature .



We have a linked list 1->2->3->4->5->6->7 and so on. You are supposed to swap pairs of a linked list like swap (1,2), (3,4), (5,6), and so on.
1. You may not modify the data in the list’s nodes; only nodes themselves may be changed. Because imagine a case where a node contains many fields, so there will be too much unnecessary swap.
2. If a pair of a node does not exist, then leave the node as it is.
class Node:
# Constructor to initialize the node object
def __init__(self, data):
self.data = data
self.next = None
class LinkedList:
# Function to initialize head
def __init__(self):
self.head = None
# Function to pairwise swap elements of a linked list
def pairwiseSwap(self):
temp = self.head
# There are no nodes in linked list
if temp is None:
return
# Traverse furthethr only if there are at least two
# left
while(temp and temp.next):
# If both nodes are same,
# no need to swap data
if(temp.data != temp.next.data):
# Swap data of node with its next node's data
temp.data, temp.next.data = temp.next.data, temp.data
# Move temp by 2 to the next pair
temp = temp.next.next
# Function to insert a new node at the beginning
def push(self, new_data):
new_node = Node(new_data)
new_node.next = self.head
self.head = new_node
# Utility function to print the linked LinkedList
def printList(self):
temp = self.head
while(temp):
print temp.data,
temp = temp.next
# Driver program
llist = LinkedList()
llist.push(5)
llist.push(4)
llist.push(3)
llist.push(2)
llist.push(1)
print "Linked list before calling pairWiseSwap() "
llist.printList()
llist.pairwiseSwap()
print "\nLinked list after calling pairWiseSwap()"
llist.printList()
It was again the morning session and the interviewer was very supportive in nature and gave me the hint too to think the approach and finally i came up the solution which he was expecting.



• The left subtree of a node contains only nodes with data less than the node’s data.
• The right subtree of a node contains only nodes with data greater than the node’s data.
• Both the left and right subtrees must also be binary search trees.

For the given BST and target value ‘K’ = 32, the closest element is 30 as the absolute difference between 30 and 32 (|32 - 30|) is the minimum among all other possible node-target pairs.
# Recursive Python program to find key
# closest to k in given Binary Search Tree.
# Utility that allocates a new node with the
# given key and NULL left and right pointers.
class newnode:
# Constructor to create a new node
def __init__(self, data):
self.key = data
self.left = None
self.right = None
# Function to find node with minimum
# absolute difference with given K
# min_diff --> minimum difference till now
# min_diff_key --> node having minimum absolute
# difference with K
def maxDiffUtil(ptr, k, min_diff, min_diff_key):
if ptr == None:
return
# If k itself is present
if ptr.key == k:
min_diff_key[0] = k
return
# update min_diff and min_diff_key by
# checking current node value
if min_diff > abs(ptr.key - k):
min_diff = abs(ptr.key - k)
min_diff_key[0] = ptr.key
# if k is less than ptr->key then move
# in left subtree else in right subtree
if k < ptr.key:
maxDiffUtil(ptr.left, k, min_diff,
min_diff_key)
else:
maxDiffUtil(ptr.right, k, min_diff,
min_diff_key)
# Wrapper over maxDiffUtil()
def maxDiff(root, k):
# Initialize minimum difference
min_diff, min_diff_key = 999999999999, [-1]
# Find value of min_diff_key (Closest
# key in tree with k)
maxDiffUtil(root, k, min_diff, min_diff_key)
return min_diff_key[0]
# Driver Code
if __name__ == '__main__':
root = newnode(9)
root.left = newnode(4)
root.right = newnode(17)
root.left.left = newnode(3)
root.left.right = newnode(6)
root.left.right.left = newnode(5)
root.left.right.right = newnode(7)
root.right.right = newnode(22)
root.right.right.left = newnode(20)
k = 18
print(maxDiff(root, k))
It was late evening and happened in a very smooth way.
What is Kernel and write its main functions?
The kernel is basically a computer program usually considered as a central component or module of OS. It is responsible for handling, managing, and controlling all operations of computer systems and hardware. Whenever the system starts, the kernel is loaded first and remains in the main memory. It also acts as an interface between user applications and hardware.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
How do you remove whitespace from the start of a string?