This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Stack; | |
public class ReverseDLL { | |
static class Node{ | |
int data; | |
Node prev; | |
Node next; | |
public Node(int data){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func findTwoRepeating(A []int) { | |
fmt.Print("Repeated Elements: ") | |
for i := 0; i < len(A); i++ { | |
for j := i + 1; j < len(A); j++ { | |
if A[i] == A[j] { | |
fmt.Print(A[i], " ") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find_two_repeating(A): | |
print("Repeated Elements:") | |
for i in range(len(A)): | |
for j in range(i + 1, len(A)): | |
if A[i] == A[j]: | |
print(A[i], end=" ") | |
if __name__ == "__main__": | |
A = [1, 5, 2, 4, 8, 9, 3, 1, 4, 0] | |
find_two_repeating(A) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MinimumCostStaircaseRecursion: | |
def minCost(self, cost): | |
stairs = len(cost) - 1 | |
return self.util(cost, -1, stairs) | |
def util(self, cost, current, stairs): | |
if current == stairs: | |
return cost[current] | |
if current > stairs: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Stack; | |
public class ReverseLL { | |
static class Node { | |
int data; | |
Node next; | |
public Node(int data) { | |
this.data = data; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.HashMap; | |
import java.util.Map; | |
public class RobotColoringProblem { | |
public boolean isPossible(int row, int col, int [][] input){ | |
if(row>=0 && col>=0 && col<input.length && row<input[0].length) | |
return true; | |
return false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.List; | |
class Lecture { | |
int startTime; | |
int endTime; | |
public Lecture(int startTime, int endTime) { | |
this.startTime = startTime; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.Comparator; | |
import java.util.List; | |
class Lecture { | |
int startTime; | |
int endTime; | |
public Lecture(int startTime, int endTime) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
public class WeightedJobSchedulingBinarySearch { | |
static class Job { | |
int start_time; | |
int end_time; | |
int weight; | |
public Job(int start_time, int end_time, int weight) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
class Job { | |
int start_time; | |
int end_time; | |
int weight; | |
public Job(int start_time, int end_time, int weight) { | |
this.start_time = start_time; | |
this.end_time = end_time; |
NewerOlder