Put init db .sql file in designated directory.
- For
MySql: /docker-entrypoint-initdb.d/ - For
PostgreSql: /docker-entrypoint-initdb.d/ - For
MS SQL Server: - 😕 https://www.abhith.net/blog/create-sql-server-database-from-a-script-in-docker-compose/
| ss://Y2hhY2hhMjAtaWV0Zi1wb2x5MTMwNTo0N3RtS0daNUJIcXo@35.209.198.215:80/?outline=1 |
| /* | |
| Sort A [a1..aN] where a1 <= aN. Then: | |
| Case 1: A=[+, +, ..., +] || A=[-, -, ..., -] => Max = Product of the last three elements | |
| Case 2: N= 3 => Only one product exists | |
| Case 3: A=[-, -, ...., +] => Max = Product of the first and the last two elements | |
| */ | |
| function solution(A) { | |
| let N = A.length; | |
| A.sort((a,b) => (a-b)); | |
| return Math.max(A[0] * A[1] * A[N - 1], A[N - 1] * A[N - 2] * A[N - 3]); |
| // Solution 1: | |
| function solution(A) { | |
| // write your code in JavaScript (Node.js 8.9.4) | |
| let wests=[]; | |
| wests[A.length-1] = A[A.length-1]==1 ? 1 : 0; | |
| for(let i=A.length-2; i>-1; i--) | |
| { | |
| wests[i] = wests[i+1]; | |
| if(A[i]==1) | |
| wests[i]++; |
| function solution(A, B, K) { | |
| // write your code in JavaScript (Node.js 8.9.4) | |
| if(K==0) return 0; | |
| const a = Math.floor(A/K); | |
| const b = Math.floor(B/K); | |
| if(a==0 && b==0 && B != 0) | |
| return 0; | |
| let between = b - a; |
| function solution(A) { | |
| // write your code in JavaScript (Node.js 8.9.4) | |
| const unique = [...new Set(A)].sort((x,y)=>x-y); | |
| if(unique.length!=A.length) return 0; | |
| for(let cntr=0; cntr<unique.length; cntr++) | |
| if(cntr+1 != unique[cntr]) | |
| return 0; | |
| return 1; | |
| } |
| function solution(A) { | |
| // write your code in JavaScript (Node.js 8.9.4) | |
| const sorted = [...new Set(A)]; | |
| var positives = sorted.filter(p=>p>0).sort((x,y)=>x-y); | |
| if(positives.length==0) return 1; | |
| for(let cntr=0; cntr<positives.length; cntr++) | |
| if(cntr+1 != positives[cntr]) | |
| return cntr+1; | |
| return positives[positives.length-1] + 1; | |
| } |
| function solution(N, A) { | |
| var counters = new Array(N); | |
| var max = 0; | |
| var toBeAppliedMax = 0; | |
| for (let K = 0; K < A.length; K++) { | |
| const op = A[K]; | |
| if (op == N + 1) { | |
| toBeAppliedMax = max; |
Put init db .sql file in designated directory.
MySql:
/docker-entrypoint-initdb.d/
PostgreSql:
/docker-entrypoint-initdb.d/
MS SQL Server:
| # To leverage layering, I've splitted the process into multiple lines: | |
| RUN apt-get update | |
| RUN apt-get install -y sudo | |
| RUN apt-get install -y curl | |
| RUN curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - | |
| RUN apt-get install -y nodejs nodejs |
Compound Components pattern is grouping related components together in a way so that it becomes easier to read and more extensible.