Skip to content

[pull] master from fishercoder1534:master #1301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 587 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
587 commits
Select commit Hold shift + click to select a range
080a37e
add 2115
fishercoder1534 Jul 22, 2024
69f96b1
add 1711
fishercoder1534 Jul 22, 2024
529f822
add 2192
fishercoder1534 Jul 22, 2024
19234d9
add 1059
fishercoder1534 Jul 22, 2024
28170cf
add 1462
fishercoder1534 Jul 23, 2024
5628481
add a solution for 1636
fishercoder1534 Jul 23, 2024
83d657a
add 1034
fishercoder1534 Jul 23, 2024
69c6f60
add a solution for 684
fishercoder1534 Jul 23, 2024
84fdd1f
add a comment for 684
fishercoder1534 Jul 23, 2024
4ab2386
add 2423
fishercoder1534 Jul 23, 2024
25760b4
add 2191
fishercoder1534 Jul 24, 2024
187e677
add 2446
fishercoder1534 Jul 24, 2024
c1a79c5
update 2446
fishercoder1534 Jul 24, 2024
357fd5c
add 722
fishercoder1534 Jul 24, 2024
1ae82de
update 722
fishercoder1534 Jul 24, 2024
807a903
add 2451
fishercoder1534 Jul 24, 2024
156ed33
add 2460
fishercoder1534 Jul 24, 2024
fef90ae
add 2465
fishercoder1534 Jul 24, 2024
e08bcb4
add 2475
fishercoder1534 Jul 24, 2024
224a360
add 2481
fishercoder1534 Jul 24, 2024
78a3426
add 2490
fishercoder1534 Jul 24, 2024
deb93fa
add 2500
fishercoder1534 Jul 24, 2024
334750e
add 2578
fishercoder1534 Jul 24, 2024
329c8e9
add 2574
fishercoder1534 Jul 24, 2024
e11ca76
add 2570
fishercoder1534 Jul 24, 2024
6fa2a66
add 912
fishercoder1534 Jul 25, 2024
979ab4b
add 912
fishercoder1534 Jul 25, 2024
0c547ba
update 912
fishercoder1534 Jul 25, 2024
1458f2d
add 2511
fishercoder1534 Jul 25, 2024
ea0b1aa
add 2591
fishercoder1534 Jul 25, 2024
63acd06
add 2600
fishercoder1534 Jul 25, 2024
5a313b6
add 2605
fishercoder1534 Jul 25, 2024
c060665
add 2609
fishercoder1534 Jul 25, 2024
ea493d5
add 2678
fishercoder1534 Jul 25, 2024
708dc43
add 2660
fishercoder1534 Jul 25, 2024
5673ce4
add 2656
fishercoder1534 Jul 25, 2024
f0694b3
add 2652
fishercoder1534 Jul 25, 2024
d6a0f5c
add 2651
fishercoder1534 Jul 25, 2024
030fcfc
add 2644
fishercoder1534 Jul 25, 2024
267e27a
add 2639
fishercoder1534 Jul 25, 2024
b8ac792
add 2614
fishercoder1534 Jul 25, 2024
f62bb60
update 204
fishercoder1534 Jul 25, 2024
cc63f52
add 2682
fishercoder1534 Jul 26, 2024
9906511
add 2760
fishercoder1534 Jul 26, 2024
26c71e1
add 2748
fishercoder1534 Jul 26, 2024
84e46d6
add 1334
fishercoder1534 Jul 26, 2024
dcf570b
add comments for 1334
fishercoder1534 Jul 26, 2024
25919d9
add 2744
fishercoder1534 Jul 26, 2024
eb240b3
add 2739
fishercoder1534 Jul 26, 2024
4b00230
add 2733
fishercoder1534 Jul 26, 2024
843dd20
add 2729
fishercoder1534 Jul 26, 2024
201c941
add 2728
fishercoder1534 Jul 26, 2024
a2bd76a
add 2976
fishercoder1534 Jul 27, 2024
d22ee01
update 2976
fishercoder1534 Jul 27, 2024
0e6c1ca
add 3112
fishercoder1534 Jul 27, 2024
7088197
fix build
fishercoder1534 Jul 27, 2024
fab52a1
add 2689
fishercoder1534 Jul 27, 2024
30e41eb
update 2689
fishercoder1534 Jul 27, 2024
77f2253
add 2473
fishercoder1534 Jul 27, 2024
11fa31b
add 2717
fishercoder1534 Jul 27, 2024
dffd16f
add 433
fishercoder1534 Jul 27, 2024
123d307
add 3232
fishercoder1534 Jul 28, 2024
9b62138
update 204
fishercoder1534 Jul 28, 2024
876fab0
add 3233
fishercoder1534 Jul 28, 2024
f18f8fd
update 204
fishercoder1534 Jul 28, 2024
d7a6455
add 3234
fishercoder1534 Jul 28, 2024
70b936f
add 2778
fishercoder1534 Jul 28, 2024
d52ce98
add 2784
fishercoder1534 Jul 28, 2024
5f413c1
update 350
fishercoder1534 Jul 28, 2024
73b5314
add 1509
fishercoder1534 Jul 28, 2024
8fe955f
fix build
fishercoder1534 Jul 28, 2024
8db401c
add 2788
fishercoder1534 Jul 28, 2024
0033ba7
add 2815
fishercoder1534 Jul 28, 2024
4caaac2
update 1395
fishercoder1534 Jul 29, 2024
5390d9c
add 2798
fishercoder1534 Jul 29, 2024
da6f496
update 300
fishercoder1534 Jul 29, 2024
765af62
update 334
fishercoder1534 Jul 29, 2024
3b9cbaf
update 646
fishercoder1534 Jul 29, 2024
6b26eba
update 646
fishercoder1534 Jul 29, 2024
3101b94
add 777
fishercoder1534 Jul 29, 2024
2410f91
add 1653
fishercoder1534 Jul 30, 2024
0c1a55f
add 2806
fishercoder1534 Jul 30, 2024
46d0266
add 2828
fishercoder1534 Jul 30, 2024
41e35d3
add 2833
fishercoder1534 Jul 30, 2024
8a7990d
add 2839
fishercoder1534 Jul 30, 2024
569127e
add 2873
fishercoder1534 Jul 30, 2024
8cac237
add 2869
fishercoder1534 Jul 30, 2024
6321f13
add 2859
fishercoder1534 Jul 30, 2024
446f006
add 2855
fishercoder1534 Jul 30, 2024
d6ae066
add 2848
fishercoder1534 Jul 30, 2024
194b800
add 2843
fishercoder1534 Jul 30, 2024
58ae826
add 1105
fishercoder1534 Jul 31, 2024
3411d5d
update 1105
fishercoder1534 Jul 31, 2024
99879b4
add 1230
fishercoder1534 Jul 31, 2024
8c1911f
add 2894
fishercoder1534 Jul 31, 2024
4ff9abb
add 2899
fishercoder1534 Jul 31, 2024
3178798
add 2900
fishercoder1534 Jul 31, 2024
38658ee
add 2903
fishercoder1534 Jul 31, 2024
4f44456
add 2908
fishercoder1534 Jul 31, 2024
149643d
add 2913
fishercoder1534 Jul 31, 2024
c066589
add 2917
fishercoder1534 Jul 31, 2024
90a6a7f
add 2923
fishercoder1534 Jul 31, 2024
1521278
add 2928
fishercoder1534 Jul 31, 2024
5fdc09c
add 2932
fishercoder1534 Jul 31, 2024
4413019
add 1741
fishercoder1534 Jul 31, 2024
ad4bc9d
add 3168
fishercoder1534 Jul 31, 2024
d3e4dd9
add 3172
fishercoder1534 Jul 31, 2024
1f58c68
add a solution for 3178
fishercoder1534 Jul 31, 2024
6580909
add 3198
fishercoder1534 Jul 31, 2024
c256d2d
add 2960
fishercoder1534 Jul 31, 2024
0b92c10
add 2956
fishercoder1534 Jul 31, 2024
3655f82
add 2951
fishercoder1534 Jul 31, 2024
258ccad
add 2946
fishercoder1534 Jul 31, 2024
36553b0
add 1789
fishercoder1534 Jul 31, 2024
91888f7
update 1062
fishercoder1534 Aug 1, 2024
2965ba6
update 3233 test to the right folder
fishercoder1534 Aug 1, 2024
fa257a9
update 3233 test to the right folder
fishercoder1534 Aug 1, 2024
8bce341
add 3237
fishercoder1534 Aug 1, 2024
c048861
update 3237
fishercoder1534 Aug 1, 2024
1b739eb
add 3158
fishercoder1534 Aug 1, 2024
104c885
add 3151
fishercoder1534 Aug 1, 2024
0190cf4
add 3146
fishercoder1534 Aug 1, 2024
b3ada51
add 3136
fishercoder1534 Aug 1, 2024
4c9c1af
add 3114
fishercoder1534 Aug 1, 2024
6a917b3
add 3099
fishercoder1534 Aug 1, 2024
a9b314e
add 3079
fishercoder1534 Aug 1, 2024
adfb14d
add 3069
fishercoder1534 Aug 1, 2024
e4fe2a0
add 3065
fishercoder1534 Aug 1, 2024
1af29b4
add 3063
fishercoder1534 Aug 1, 2024
d07e9a9
add 3032
fishercoder1534 Aug 1, 2024
6b81080
add 3028
fishercoder1534 Aug 1, 2024
aec0cb3
add 3024
fishercoder1534 Aug 1, 2024
a56c625
fix build
fishercoder1534 Aug 1, 2024
b6934ae
add 3019
fishercoder1534 Aug 1, 2024
1c3246b
add 3000
fishercoder1534 Aug 1, 2024
0629e9f
add 2996
fishercoder1534 Aug 1, 2024
a087125
add 2980
fishercoder1534 Aug 1, 2024
1b1fecb
add 2703
fishercoder1534 Aug 1, 2024
0f9beff
add Javascript README.md
fishercoder1534 Aug 1, 2024
59ad48d
update 2134
fishercoder1534 Aug 2, 2024
d9fba9d
add 1151
fishercoder1534 Aug 2, 2024
2ddd24e
add 2619
fishercoder1534 Aug 2, 2024
c7bcbc2
add 2620
fishercoder1534 Aug 2, 2024
4fa6888
add 2205
fishercoder1534 Aug 2, 2024
8886e2d
add 2990
fishercoder1534 Aug 2, 2024
9d171e4
add 2082
fishercoder1534 Aug 2, 2024
a886cbd
add 2072
fishercoder1534 Aug 2, 2024
37459a8
add 2026
fishercoder1534 Aug 2, 2024
cbbf39f
add 1978
fishercoder1534 Aug 2, 2024
f47f491
add 1795
fishercoder1534 Aug 2, 2024
06da90a
add 1809
fishercoder1534 Aug 2, 2024
f937062
add 1821
fishercoder1534 Aug 2, 2024
e21914a
add 1853
fishercoder1534 Aug 2, 2024
2dae9f2
add 1873
fishercoder1534 Aug 2, 2024
802ee0f
add 3150
fishercoder1534 Aug 2, 2024
2005857
add 3059
fishercoder1534 Aug 2, 2024
def35a0
add 3051
fishercoder1534 Aug 2, 2024
99c9038
fix 3051
fishercoder1534 Aug 2, 2024
088ebc7
add 519
fishercoder1534 Aug 2, 2024
e3380d3
update 1460
fishercoder1534 Aug 3, 2024
efd44e5
add 3238
fishercoder1534 Aug 3, 2024
9649b7e
add 3239
fishercoder1534 Aug 3, 2024
8840b7b
add 3241
fishercoder1534 Aug 3, 2024
571b05e
add 3240
fishercoder1534 Aug 3, 2024
6b0cf19
add 3243
fishercoder1534 Aug 4, 2024
347a4da
add 3242
fishercoder1534 Aug 4, 2024
bd40c63
update 1508
fishercoder1534 Aug 4, 2024
89f06ef
update 823 test
fishercoder1534 Aug 5, 2024
22de77d
update 821 test
fishercoder1534 Aug 5, 2024
a454a63
add 3016
fishercoder1534 Aug 6, 2024
d9e6598
update 999 test
fishercoder1534 Aug 6, 2024
051f2b6
update 1985 test
fishercoder1534 Aug 6, 2024
da6ce3e
remove unused assignments
fishercoder1534 Aug 6, 2024
b8c6009
update 885 test
fishercoder1534 Aug 8, 2024
7edc4bd
update 885
fishercoder1534 Aug 8, 2024
bce1973
update 351 test
fishercoder1534 Aug 8, 2024
8be01e9
update 985 test
fishercoder1534 Aug 8, 2024
f45bfec
update 351 test
fishercoder1534 Aug 8, 2024
9d927d7
update 351 test
fishercoder1534 Aug 8, 2024
440b096
update 840
fishercoder1534 Aug 9, 2024
41b4abe
Updated the project to use JUnit 5 instead of JUnit 4 (#185)
javadev Aug 11, 2024
b61d906
update 100 test
fishercoder1534 Aug 11, 2024
9db165d
add 3248
fishercoder1534 Aug 11, 2024
8a6c4d1
add 3249
fishercoder1534 Aug 11, 2024
a9bde29
update 703
fishercoder1534 Aug 12, 2024
52642b0
add a solution for 860
fishercoder1534 Aug 15, 2024
263e016
add a solution for 624
fishercoder1534 Aug 16, 2024
22462af
add a test for 3189
fishercoder1534 Aug 16, 2024
29f7c04
Migrated Build System to Gradle 8.9 and Java 17 (#186)
javadev Aug 16, 2024
873165c
add 3254
fishercoder1534 Aug 17, 2024
8973db1
add a solution for 264
fishercoder1534 Aug 18, 2024
c04ffdc
update 264
fishercoder1534 Aug 18, 2024
4665ffa
add 3258
fishercoder1534 Aug 18, 2024
3a37876
update 145
fishercoder1534 Aug 25, 2024
0768d3a
add 3263
fishercoder1534 Aug 25, 2024
d5427fb
add 3264
fishercoder1534 Aug 25, 2024
002f88c
update 590
fishercoder1534 Aug 26, 2024
455f1b2
[LEET-2022] refactor 2022
fishercoder1534 Sep 1, 2024
4ab9fe5
[LEET-1894] refactor 1894
fishercoder1534 Sep 2, 2024
bde6a61
The Spotless Gradle plugin has been added (#187)
javadev Sep 8, 2024
824958c
[LEET-3285] add 3285
fishercoder1534 Oct 14, 2024
7b53699
[LEET-3318] add 3318
fishercoder1534 Oct 22, 2024
0605e0c
[LEET-3318] fix build
fishercoder1534 Oct 22, 2024
fd3a747
[LEET-848] update 828
fishercoder1534 Oct 23, 2024
8c80a63
[LEET-3304] add 3304
fishercoder1534 Oct 23, 2024
de5978b
[LEET-3304] fix build
fishercoder1534 Oct 23, 2024
400b0d3
[LEET-1233] add 1233
fishercoder1534 Oct 25, 2024
ed6cf34
[LEET-1233] add 1233
fishercoder1534 Oct 25, 2024
32391a3
[LEET-3314] add 3314
fishercoder1534 Oct 25, 2024
1779d58
[LEET-3300] add 3300
fishercoder1534 Oct 25, 2024
719e69d
[LEET-3170] add 3270
fishercoder1534 Oct 25, 2024
29e4ff2
[LEET-3170] fix build
fishercoder1534 Oct 25, 2024
950f377
[LEET-3330] add 3330
fishercoder1534 Oct 26, 2024
090c5ba
[LEET-2501] add 2501
fishercoder1534 Oct 28, 2024
d75c98e
[LEET-3289] add 3289
fishercoder1534 Oct 28, 2024
d464578
[LEET-3280] add 3280
fishercoder1534 Oct 28, 2024
be32346
[LEET-3274] add 3274
fishercoder1534 Oct 28, 2024
4410dca
[LEET-3324] add 3324
fishercoder1534 Oct 28, 2024
b3d7f8d
[LEET-796] update 796
fishercoder1534 Nov 3, 2024
9782608
[LEET-3340] add 3340
fishercoder1534 Nov 3, 2024
2548c18
added js solution to _3 (#188)
sambabib Nov 7, 2024
228e78f
[LEET-3349] add 3349
fishercoder1534 Nov 10, 2024
a87e53d
[LEET-3349] add 3349
fishercoder1534 Nov 10, 2024
fa75bc2
[LEET-3354] add 3354
fishercoder1534 Nov 22, 2024
7f4897d
[LEET-3354] fix build
fishercoder1534 Nov 22, 2024
db04d73
[LEET-3360] add 3360
fishercoder1534 Nov 24, 2024
7ae0dca
[LEET-3364] add 3364
fishercoder1534 Nov 27, 2024
07480d6
[LEET-3345] add 3345
fishercoder1534 Nov 27, 2024
6e4e51a
[LEET-3370] add 3370
fishercoder1534 Dec 1, 2024
113a987
[LEET-3353] add 3353
fishercoder1534 Dec 1, 2024
9d3acfb
[LEET-2879] add 2879
fishercoder1534 Dec 1, 2024
807a70b
[LEET-2879] fix link
fishercoder1534 Dec 1, 2024
e1ef41f
[LEET-2001] fix link
fishercoder1534 Dec 1, 2024
fec696f
[LEET-2879] fix link
fishercoder1534 Dec 1, 2024
0b3d11c
[LEET-3396] add 3396
fishercoder1534 Dec 26, 2024
f38d991
[LEET-3392] add 3392
fishercoder1534 Dec 26, 2024
f3e7703
js solution 994 (#189)
sambabib Jan 5, 2025
13c62b7
[LEET-3375] ADD 3375
fishercoder1534 Jan 5, 2025
d421171
[LEET-3379] add 3379
fishercoder1534 Jan 5, 2025
e3f477d
_916.cpp (#190)
yashgarg7302 Jan 12, 2025
0d31b5a
[LEET-3386] add 3386
fishercoder1534 Jan 26, 2025
e5982a9
[LEET-3471] add 3471
fishercoder1534 Mar 3, 2025
efa91d4
[LEET-3471] add 3471 test
fishercoder1534 Mar 3, 2025
6adfdf0
[LEET-3502] add 3502
fishercoder1534 Mar 31, 2025
f557f7b
[LEET-3502] fix unit test
fishercoder1534 Mar 31, 2025
defdfd0
[LEET-3402] add 3402
fishercoder1534 Apr 7, 2025
9db17c3
[LEET-3402] fix unit test
fishercoder1534 Apr 7, 2025
9dc0047
[LEET-3491] add 3491
fishercoder1534 Apr 27, 2025
7b54621
[LEET-3491] fix unit test
fishercoder1534 Apr 27, 2025
dd67dd3
[LEET-3477] add 3477
fishercoder1534 Apr 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
8 changes: 4 additions & 4 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v3
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
java-version: '17'
cache: 'gradle'
- name: Build with Gradle
run: chmod +x gradlew && ./gradlew build
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ out/
*.iml
*.vscode/
src/main/java/com/fishercoder/solutions/_99999RandomQuestions.java
.project
src/main/java/com/fishercoder/solutions/_Contest.java
.project
bin
1,534 changes: 12 additions & 1,522 deletions README.md

Large diffs are not rendered by default.

85 changes: 52 additions & 33 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,53 +1,72 @@
apply plugin: 'java'
apply plugin: 'checkstyle'
plugins {
id 'java'
id 'checkstyle'
id 'com.diffplug.spotless' version '6.25.0'
}

group = 'com.fishercoder'
version = '1.0-SNAPSHOT'

javadoc.options.encoding = 'UTF-8'
compileJava.options.encoding = 'UTF-8'

checkstyle {
//include ( '**/*.java')
configFile = file("${rootDir}/fishercoder_checkstyle.xml")
}

sourceSets {
main {
java {
srcDir 'src/fishercoder'
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

description = """"""
tasks.javadoc {
options.encoding = 'UTF-8'
}

sourceCompatibility = 1.8
targetCompatibility = 1.8
tasks.compileJava {
options.encoding = 'UTF-8'
}

repositories {
mavenCentral()
maven { url "http://repo.maven.apache.org/maven2" }
}

dependencies {
compile 'com.google.code.gson:gson:2.8.0'
compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.0'
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'org.apache.commons:commons-collections4:4.0'

testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3'

// TODO: to remove Junit4 after all tests are migrated to Junit5
compile 'junit:junit:4.13'
testCompile "junit:junit:4.13.1"
testImplementation 'org.assertj:assertj-core:3.11.1'
compileOnly 'org.projectlombok:lombok:1.18.32'
annotationProcessor 'org.projectlombok:lombok:1.18.32'
testCompileOnly 'org.projectlombok:lombok:1.18.32'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.32'
}

testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
testing {
suites {
test {
useJUnitJupiter()
}
}
}

testCompile("org.assertj:assertj-core:3.11.1")
compileOnly 'org.projectlombok:lombok:1.18.12'
annotationProcessor 'org.projectlombok:lombok:1.18.12'
testCompileOnly 'org.projectlombok:lombok:1.18.12'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.12'
tasks.withType(Test).configureEach {
maxParallelForks = Runtime.runtime.availableProcessors()
}

test {
useJUnitPlatform()
checkstyle {
toolVersion = '6.17'
config = rootProject.resources.text.fromFile('fishercoder_checkstyle.xml')
}

spotless {
java {
encoding 'UTF-8'
target fileTree(projectDir) {
include '**/src/**/*.java'
exclude '**/build/**'
}
importOrder '\\#', '', '*'
removeUnusedImports()
googleJavaFormat('1.22.0').aosp()
toggleOffOn()
endWithNewline()
}
}
34 changes: 34 additions & 0 deletions cpp/_916.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
class Solution {
public:
vector<string> wordSubsets(vector<string>& words1, vector<string>& words2) {
int maxCharFreq[26] = {0};
int tempCharFreq[26];
for (const auto& word : words2) {
memset(tempCharFreq, 0, sizeof tempCharFreq);
for (char ch : word) {
tempCharFreq[ch - 'a']++;
}
for (int i = 0; i < 26; ++i) {
maxCharFreq[i] = max(maxCharFreq[i], tempCharFreq[i]);
}
}
vector<string> universalWords;
for (const auto& word : words1) {
memset(tempCharFreq, 0, sizeof tempCharFreq);
for (char ch : word) {
tempCharFreq[ch - 'a']++;
}
bool isUniversal = true;
for (int i = 0; i < 26; ++i) {
if (maxCharFreq[i] > tempCharFreq[i]) {
isUniversal = false;
break;
}
}
if (isUniversal) {
universalWords.emplace_back(word);
}
}
return universalWords;
}
};
4 changes: 4 additions & 0 deletions database/_1741.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- # Write your MySQL query statement below
select event_day as day, emp_id, sum(out_time - in_time) as total_time
from Employees
group by day, emp_id
5 changes: 5 additions & 0 deletions database/_1789.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- # Write your MySQL query statement below
select employee_id, department_id
from (select *, count(employee_id) over(partition by employee_id) as EmployeeCount from Employee) EP
where EmployeeCount = 1
or primary_flag = 'Y';
12 changes: 12 additions & 0 deletions database/_1795.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- Write your PostgreSQL query statement below
select product_id, 'store1' as store, store1 as price
from Products
where store1 is not null
union
select product_id, 'store2' as store, store2 as price
from Products
where store2 is not null
union
select product_id, 'store3' as store, store3 as price
from Products
where store3 is not null
13 changes: 13 additions & 0 deletions database/_1809.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-- Write your PostgreSQL query statement below
-- my completely original solution
with sessions_with_ads as (select p.customer_id, p.session_id, p.start_time, p.end_time, a.timestamp as ts, a.ad_id
from Playback p
inner join Ads a
on p.customer_id = a.customer_id and
a.timestamp between p.start_time and p.end_time)

select distinct(session_id)
from (select distinct(session_id) from Playback)
where session_id not in (select distinct(session_id) from sessions_with_ads)


2 changes: 2 additions & 0 deletions database/_1821.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Write your PostgreSQL query statement below
select customer_id from Customers where revenue > 0 and year = 2021;
7 changes: 7 additions & 0 deletions database/_1853.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- Write your PostgreSQL query statement below
-- 1. use to_char function
-- 2. use FM to strip padding space, FM is a data type formatting function in PostgreSQL that removes leading zeros and trailing spaces that would otherwise be added to make a pattern's output fixed-width
-- 3. Day gives you the day in the week
-- 4. DD gives you the day in the month
-- 5. YYYY gives you the year
select to_char(day, 'FMDay, FMMonth FMDD, YYYY') as day from Days;
13 changes: 13 additions & 0 deletions database/_1873.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-- Write your PostgreSQL query statement below
with employee_bonus as (
select employee_id, salary as bonus from Employees where name not like 'M%' and employee_id % 2 = 1
),
non_employee_bonus as (
select employee_id, 0 as bonus from Employees where employee_id not in (
select employee_id from employee_bonus
))

select * from employee_bonus
union
select * from non_employee_bonus
order by employee_id
7 changes: 7 additions & 0 deletions database/_1978.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- Write your PostgreSQL query statement below
select employee_id
from Employees
where manager_id not in
(select employee_id from Employees)
and salary < 30000
order by 1 asc
5 changes: 5 additions & 0 deletions database/_2026.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- Write your PostgreSQL query statement below
select problem_id
from Problems
where (likes / ((likes + dislikes) * 1.0)) < 0.6
order by 1;
13 changes: 13 additions & 0 deletions database/_2072.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-- Write your PostgreSQL query statement below


with excellent_std_cnts as (select (select count(student_id) from NewYork where score >= 90) as ny,
(select count(student_id) from California where score >= 90) as ca)

select (case
when E.ny > E.ca then 'New York University'
when E.ny < E.ca then 'California University'
else 'No Winner'
end
) as winner
from excellent_std_cnts as E
4 changes: 4 additions & 0 deletions database/_2082.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- #Write your MySQL query statement below
select count(distinct customer_id) as rich_count
from Store
where amount > 500;
8 changes: 8 additions & 0 deletions database/_2205.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CREATE FUNCTION getUserIDs(startDate DATE, endDate DATE, minAmount INT) RETURNS INT
BEGIN
RETURN (
-- # Write your MySQL query statement below.
select count(distinct(user_id)) from Purchases where
time_stamp between timestamp(startDate) and timestamp(endDate) and amount >= minAmount
);
END
7 changes: 7 additions & 0 deletions database/_2990.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- # Write your MySQL query statement below
select user_id
from Loans
group by user_id
having sum(loan_type = "Refinance") > 0
and sum(loan_type = "Mortgage") > 0
order by 1 asc;
4 changes: 4 additions & 0 deletions database/_3051.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- Write your PostgreSQL query statement below
select candidate_id from Candidates
where skill in ('Python', 'Tableau', 'PostgreSQL') group by 1
having count(candidate_id) = 3 order by 1
7 changes: 7 additions & 0 deletions database/_3059.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- Write your MySQL query statement below
select substring(email, position('@' in email) + 1) as email_domain,
count(*) as count
from emails
where email like '%@%.com'
group by 1
order by 1;
7 changes: 7 additions & 0 deletions database/_3150.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- Write your PostgreSQL query statement below
select tweet_id
from tweets
where length(content) > 140
or regexp_count(content, '@\w') > 3
or regexp_count(content, '#\w') > 3
order by 1
7 changes: 7 additions & 0 deletions database/_3172.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- Write your MySQL query statement below
-- my completely original solution
select user_id
from emails as e
join texts as t on e.email_id = t.email_id
where date_add(date(e.signup_date), Interval 1 Day) = date (t.action_date) and signup_action = 'Verified'
order by user_id
6 changes: 6 additions & 0 deletions database/_3198.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- # Write your MySQL query statement below
select state,
group_concat(city order by city SEPARATOR ', ') as cities
from cities
group by state
order by state
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
43 changes: 43 additions & 0 deletions javascript/_17.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
function letterCombinations(digits) {
// If the input is an empty string, return an empty array.
if (digits.length === 0) {
return [];
}

// Mapping of digits to letters as per the telephone keypad using a javascript dictionary.
const digitToChar = {
'2': ['a', 'b', 'c'],
'3': ['d', 'e', 'f'],
'4': ['g', 'h', 'i'],
'5': ['j', 'k', 'l'],
'6': ['m', 'n', 'o'],
'7': ['p', 'q', 'r', 's'],
'8': ['t', 'u', 'v'],
'9': ['w', 'x', 'y', 'z']
};

// Resultant array to store all possible combinations
const result = [];

// Backtracking function to generate combinations
function backtrack(index, currentCombination) {
// if the current combination has the same length as the input digits.
if (index === digits.length) {
result.push(currentCombination);
return;
}

// Get the letters that the current digit maps to.
let letters = digitToChar[digits[index]];

// Loop through the letters and call backtrack recursively for the next digit.
for (let letter of letters) {
backtrack(index + 1, currentCombination + letter);
}
}

// Start backtracking from the first digit (index 0) with an empty string as the initial combination.
backtrack(0, '');

return result;
};
Loading