
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Arnab Chakraborty has Published 4293 Articles
Program to find k-sized list where difference between largest and smallest item is minimum in Python

Arnab Chakraborty
217 Views
Suppose we have a list of numbers called nums and an integer k, we have to select elements from nums to create a list of size k such that the difference between the largest integer in the list and the smallest integer is as low as possible. And we will ... Read More

Arnab Chakraborty
237 Views
Suppose we have a list of strings words, we have to group all anagrams together and return the size of the largest grouping.So, if the input is like words = ["xy", "yx", "xyz", "zyx", "yzx", "wwwww"], then the output will be 3, as ["xyz", "zyx", "yzx"] is the largest grouping.To ... Read More

Arnab Chakraborty
465 Views
Suppose we have a string s of lowercase alphabet characters, and another number k, we have to find the minimum number of required changes in the string so that the resulting string has at most k distinct characters. In this case The change is actually changing a single character to ... Read More

Arnab Chakraborty
541 Views
Suppose we have a list of sorted unique numbers called nums and an integer k, we have to find the kth missing number from the first element of the given list.So, if the input is like nums = [5, 6, 8, 10, 11], k = 1, then the output will ... Read More

Arnab Chakraborty
1K+ Views
Suppose we have a singly linked list, we have to check find the value of the kth last node (0-indexed). We have to solve this in single pass.So, if the input is like node = [5, 4, 6, 3, 4, 7], k = 2, then the output will be 3, ... Read More

Arnab Chakraborty
335 Views
Suppose we have a list of stacks and an integer k. We have to find the maximum possible sum that can be achieved from popping off exactly k elements from any combination of the stacks.So, if the input is like stacks = [[50, -4, -15], [2], [6, 7, 8]], k ... Read More

Arnab Chakraborty
284 Views
Suppose we have a list of numbers called nums and another number k, we have to find a list of count of distinct numbers in each window of size k.So, if the input is like nums = [2, 2, 3, 3, 4], k = 2, then the output will be ... Read More

Arnab Chakraborty
501 Views
Suppose we have a binary matrix where 0 shows empty cell and 1 shows a block that forms a shape, now we have to find the perimeter of the shape. The shape will not hold any hole inside it.So, if the input is like0000000111001100111000000then the output will be 14.To solve ... Read More

Arnab Chakraborty
533 Views
Suppose we have two linked lists l1 and l2, we have to return one linked list by interleaving elements of these two lists starting with l1. If there are any leftover nodes in a linked list, they should be appended to the list.So, if the input is like l1 = ... Read More

Arnab Chakraborty
254 Views
Suppose we have a number n, we have to find the number of n-digit positive integers such that the digits are in strictly increasing order.So, if the input is like n = 3, then the output will be 84, as numbers are 123, 124, 125, ..., 678, 789To solve this, ... Read More