Difference between string and String in C#

In this article, we will learn about what is the difference between string and String in C#. In C#, string is an alias for the String class in .NET. In fact, every C# type has an equivalent in .NET. As another example, short and int in C# map to Int16 and Int32  in .NET. In C#, string is a class. Both string and String class comes from …

Continue reading Difference between string and String in C#

Binary Search – Best Explanation

Hi Geeks! Today, we going to see about Binary Search Algorithm to search an element in an array. When an array is sorted, we can apply the binary search algorithm. There are two ways to search an element in an array. Linear SearchBinary Search Linear Search When an array is unsorted, we can apply the …

Continue reading Binary Search – Best Explanation

How to achieve your GOAL?

Each and everyone should have GOAL in their life. It may be anything. We have to achieve something in our life. Our life should be meaningful. Life is not a game. There is a purpose in our life. I have followed some practical examples, to achieve my goals in life. It's really helping me. So …

Continue reading How to achieve your GOAL?

13) Remove Nth Node From End of List

Hi friends, in this article we going to see how to remove the Nth node from end of the list. Here is our given problem, Given a linked list, remove the n-th node from the end of list and return its head. Example: Given linked list: 1->2->3->4->5, and n = 2. After removing the second node …

Continue reading 13) Remove Nth Node From End of List

12) Linked List – Add Two Numbers

You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list. You may assume the two numbers do not contain any leading zero, except the number 0 itself. Example: Input: (2 -> …

Continue reading 12) Linked List – Add Two Numbers

11) Palindrome Linked List

This is our given problem, Given a singly linked list, determine if it is a palindrome. Example 1: Input: 1->2 Output: false Example 2: Input: 1->2->2->1 Output: true Follow up:Could you do it in O(n) time and O(1) space? How can we APPROACH this problem? By using two ways, we can solve this problem, Slow …

Continue reading 11) Palindrome Linked List

10) Merge Two Sorted Lists

Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. Example: Input: 1->2->4, 1->3->4 Output: 1->1->2->3->4->4 Explanation L1 = 1->4 L2 = 2->3 Output = 1->2->3->4 Create a dummy node. ListNode dummy = new ListNode(0); //dummy = …

Continue reading 10) Merge Two Sorted Lists