-
Write a function solution that, given two integers A and B, returns the number of integers from the range [A..B](ends are included) which can be expressed as the product of two consecutive integers, that is X*(X+1), for some integer X and A <= B. Example: Given A = 6 and B = 20, the function should return 3 These integers are: 6 = 2 * 3, 12 = 3 * 4, and 20 = 4 * 5. Similarly, given A = 21 and B = 29, the function should return 0, There are no integers of the form X * (X + 1), for some integer X.
-
You are given an implementation of a funtion: class Solution { public int solution(int[] A) } which accepts as input a non-empty zero-indexed array A consisting of N integers. The function works slowly on large input data and the goal is to optimize it so as to achieve better time and/or space complexity. The optimize function should return the same result as the given implementation for every input that satisfies the assumptions.
-
You are given an array A of N positive integer and an integer K. Find the largest possible even sum of K elements at different positions in A. For Example given A = [4,9,8,2,6] and K=3, the largest even sum of three elements is 18. The three selected elements are A[0]=4, A[2]=8 and A[4]=6. Similarly for given A = [2,3,3,5,5] and K=3, the largest even sum of three elements is 12, because 5+5+2 = 12.
-
Notifications
You must be signed in to change notification settings - Fork 0
vickhny/CodilityTest
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published