How to Search a 2d Matrix/Array in Java
The challenge
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:
- Integers in each …
In-depth guides, insights, and best practices for modern software engineering
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:
Write a function that returns the total surface area and volume of a box as an array: [area, volume]
We know that …
Read Article →Complete the function which takes two arguments and returns all numbers which are divisible by the given divisor. First argument is an …
Read Article →There comes a time when you need to split out a subdirectory into it’s own git repo.
This is a very simple task if you don’t care about …
Read Article →Given a non-empty array of numbers, a, a1, a2, … , an-1, where 0 ≤ ai < 231.
Find the maximum result of ai XOR aj, where 0 ≤ i, j …!-->!-->!-->!-->
Read Article →Given a number, find its opposite.
Examples:
1: -1
14: -14
-34: 34
We return the number itself multiplied by a …
Read Article →You are given the length and width of a 4-sided polygon. The polygon can either be a rectangle or a square.
If it is a square, return …
We take in a String where the first place contains a number, write a function that takes in this String and returns an int containing …
Given a sorted (in ascending order) integer array nums of n elements and a target value, write a function to search target in nums. If …
Given a linked list, rotate the list to the right by k places, where k is non-negative.
Example 1:
Example 2:
Read Article →You are given the root node of a binary search tree (BST) and a value to insert into the tree. Return the root node of the BST after the …
Every non-negative integer N has a binary representation. For example, 5 can be represented as "101" in binary, 11 as …