Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Java (not to be confused with JavaScript) is a class-based, object-oriented, strongly typed, reflective language and run-time environment (JRE). Java programs are compiled to bytecode and run in a virtual machine (JVM) enabling a "write once, run anywhere" (WORA) methodology.
4
votes
2
answers
501
views
Leetcode: Steps to Make Array Non-decreasing
So far here is my solution in Java:
class Solution {
private static void swap(int[] arr, int i, int ni) {
int temp = arr[i];
arr[i] = arr[ni];
arr[ni] = temp;
}
public int totalSteps …
9
votes
4
answers
2k
views
Leetcode : First Missing Positive
I was trying out leetcode's first missing positive.
As per the challenge's description:
Given an unsorted integer array nums, return the smallest missing
positive integer.
You must implement an algo …
0
votes
Accepted
Leetcode: Steps to Make Array Non-decreasing
Update
After several trials and coming up with multiple approaches, this exercise is not solvable in O(1) memory space/ with O(n) time complexity - to the best of my knowledge and trials past couple …
5
votes
1
answer
344
views
Leetcode: Largest Number
I was trying out leetcode's Largest Number.
As per the challenge's description:
Given a list of non-negative integers nums, arrange them such that
they form the largest number and return it. Since t …
3
votes
1
answer
227
views
Leetcode: Number of Islands - BFS (Queue vs Recursion)
Here are both BFS using queue / BFS using recursion code (java):
BFS (Queue)
// Directions: Down, right, Up, left - ie incrementing either row index or col index
private static final int[][] directions …