leetcode 2037 solution in java

Minimum Number of Moves to Seat Everyone There are n seats and n students in a room. You are given an array seats of length n, where seats[i] is the position of the ith seat. You are also given the array students of length n, where students[j] is the position of the jth student. You…

leetcode 2006 solution in java

Count Number of Pairs With Absolute Difference K Given an integer array nums and an integer k, return the number of pairs (i, j) where i < j such that |nums[i] – nums[j]| == k. The value of |x| is defined as: x if x >= 0. -x if x < 0. This above problem…