This file contains hidden or 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
/* | |
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]; |
This file contains hidden or 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
/* | |
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; |
This file contains hidden or 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 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]; |
This file contains hidden or 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 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) { |
This file contains hidden or 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
<?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> |
This file contains hidden or 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 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 |
This file contains hidden or 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
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) { |
This file contains hidden or 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
# 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" |
This file contains hidden or 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
pip install django |
This file contains hidden or 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
django-admin startproject first_project |