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
/*
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/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;
@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];
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) {
<?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>
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
public class UserBean {
// fields to construct a bean. Recommended to make all private in singleton design pattern.
private String name;
private int age;
private boolean male;
// bean must have its default constructor.
public UserBean() {}
public UserBean(String name, int age, boolean male) {
# install spotipy in your command line
pip install spotipy --upgrade
# import spotipy to set up your client account
from spotipy.oauth2 import SpotifyClientCredentials
import spotipy
# copy your client id and secret key on your spotify dashboard
# set them up using spotipy client credentials object to let spotipy retrive data by your query
client_id="your_id"
pip install django
django-admin startproject first_project