Write a program to delete a node at Nth position from Linked List. Given a linked list, we have to write a method to delete a node from Nth position.
-
Related Posts (YARPP)
-
Topics
-
-
Write a program to delete a node at Nth position from Linked List. Given a linked list, we have to write a method to delete a node from Nth position.
In this tutorial, I am going to discuss a very famous interview problem find maximum subarray sum (Kadane’s algorithm).
Given an integer array of N elements, find the maximum sum contiguous subarray (containing at least one element).
For example –
Example 1 –
Input: { 1, 2, -5, 4, 3, 8 , 5 }
Output: 20
The maximum sum of a sub–array in this array is 20. And the sub–array is (4, 3, 8, 5).
Example 2 –
Input: {-2, -1}
Output: -1
Example 3 –
Input: { 1, -3, 2, -5, 7, 6, -1, -4, 11, -23}
Output: 19
The largest sum contiguous subarray in this array is 19 ( 7, 6, -1, -4, 11).
Write a c program to find common elements in two arrays.
Given two positive integer arrays arr1 and arr2 of lengths len1 and len2. We have to write a c code to find intersection of these two arrays. Both the arrays are sorted.
Let’s assume we have following two sorted arrays arr1 and arr2.
int arr1[] = {2, 3, 4, 5, 6};
int arr2[] = {4, 6, 7, 8, 9};
So the common elements in these two arrays is 4 and 6.