You are given a string s and an array of pairs of indices pairs where each pair pairs[i] = [a, b] represents two indices in the string. You can swap the characters at any of these index pairs any number of times. Your task is to return the lexicographically smallest string that can be obtained after performing the swaps.
Given an integer array arr and an integer difference, find the length of the longest subsequence in arr such that the difference between each adjacent element in the subsequence equals the given difference.
You are given an array of integers nums and an integer k. A subarray is considered ’nice’ if it contains exactly k odd numbers. Your task is to return the number of nice subarrays in the given array.
Given an array where each element represents the required size of the group for each person, group the people accordingly and return the groups. Each person must be in exactly one group.