Given an integer array nums and an integer val, remove all occurrences of val in nums in-place. The order of the elements may be changed. Then return the number of elements in nums which are not equal to val. Modify the array nums such that the first k elements contain the elements which are not equal to val, and the remaining elements of nums are not important. Return k.
You are given an array of integers ’nums’. Find the next lexicographically greater permutation of the array. If no such permutation exists, return the smallest possible arrangement (sorted in ascending order). The result must be computed in place with no extra space.
You are given an array of integers where each element represents a color: 0 for red, 1 for white, and 2 for blue. Your task is to sort the array such that all reds (0) appear first, followed by whites (1), and finally blues (2). Solve the problem in one pass with constant extra space, without using any built-in sort functions.
Given the head of a linked list and a value x, partition the list such that all nodes with values less than x appear before nodes with values greater than or equal to x. The relative order of the nodes in each partition should be preserved.
A string is considered a palindrome if, after converting all uppercase letters to lowercase and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include both letters and numbers. Given a string s, return true if it is a palindrome, otherwise return false.
Given the head of a linked list, determine if there is a cycle. A cycle occurs if a node can be revisited by following the ’next’ pointers. The ‘pos’ parameter denotes where the last node connects to. If ‘pos’ is -1, there is no cycle.