You have some apples, where arr is the weight of the i-th apple. You also have a basket that can carry up to 5000 units of weight. Return the …
You are given two strings s and t of the same length. You want to change s to t. Changing the i-th character of s to i-th character of …
You may see Python code like this: for i,v in enumerate(data): pass So, what does the enumerate() function do? The enumerate() in python takes a list as its first …
Given an array of integers arr, write a function that returns true if and only if the number of occurrences of each value in the array is unique. Example …
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possible, it must rearrange it as the lowest possible order …
Given a binary tree, return the zigzag level order traversal of its nodes’ values. (ie, from left to right, then right to left for the next level and alternate …