Skip to content

Instantly share code, notes, and snippets.

View wkdalsgh192's full-sized avatar
🏠
Working from home

Blue_Avocado wkdalsgh192

🏠
Working from home
View GitHub Profile
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class ApplicationContextExam01 {
public static void main(String[] args) {
ApplicationContext ac = new ClassPathXmlApplicationContext("classpath:applicationContext.xml");
// instantiate beans below
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
https://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="..." class="...">
<!-- collaborators and configuration for this bean go here -->
</bean>
class Person{
int[] friends;
List<String> videos;
Person(int[] friends){
this.friends = friends;
}
}
class Solution {
public List<String> watchedVideosByFriends(List<List<String>> watchedVideos, int[][] friends, int id, int level) {
@wkdalsgh192
wkdalsgh192 / 765. Couples Holding Hands.java
Created January 12, 2021 04:05
765. Couples Holding Hands
class Solution {
public int minSwapsCouples(int[] row) {
int num = 0, temp = 0, cnt=0;
for (int i=0;i<row.length;i++) {
num=row[i]%2==0?row[i]+1:row[i]-1;
if (row[++i] == num) continue;
for(int j=i;j<row.length;j++) {
if (row[j] == num) {
temp = row[i];
/*
https://leetcode.com/problems/string-without-aaa-or-bbb/
*/
class Solution {
public String strWithout3a3b(int a, int b) {
StringBuilder sb = new StringBuilder();
char ch;
int acnt=0,bcnt=0;
/*
https://leetcode.com/problems/car-pooling/
*/
class Solution {
public boolean carPooling(int[][] trips, int capacity) {
int[] pick = new int[1001], drop = new int[1001];
for(int i=0;i<trips.length;i++) {
pick[trips[i][1]]+=trips[i][0];
/*
https://leetcode.com/problems/lemonade-change/
*/
class Solution {
public boolean lemonadeChange(int[] bills) {
int c1=0,c2=0,c3=0;
boolean flag = true;
public class ConnectingIsland {
static class Edge implements Comparable<Edge> {
int from;
int to;
int cost;
public Edge(int from, int to, int cost) {
super();
this.from = from;
this.to = to;
KRUSKAL(G):
A = βˆ…
For each vertex v ∈ G.V:
MAKE-SET(v)
For each edge (u, v) ∈ G.E ordered by increasing order by weight(u, v):
if FIND-SET(u) β‰  FIND-SET(v):
A = A βˆͺ {(u, v)}
UNION(u, v)
return A
import java.util.*;
class Solution {
public String solution(String number, int k) {
char[] arr = number.toCharArray();
Stack<Integer> list = new Stack<>();
for (int i = 0; i < arr.length; i++) {
int curr = (int) arr[i] - '0';
while (!list.isEmpty() && k>0 && list.peek() < curr) {
list.pop();