전체 글 359

LeetCode 1385. Find the Distance Value Between Two Arrays

Given two integer arrays arr1 and arr2, and the integer d, return the distance value between the two arrays. The distance value is defined as the number of elements arr1[i] such that there is not any element arr2[j] where |arr1[i]-arr2[j]| d=2 |4-9|=5 > d=2 |4-1|=3 > d=2 |4-8|=4 > d=2 For arr1[1]=5 we have: |5-10|=5 > d=2 |5-9|=4 > d=2 |5-1|=4 > d=2 |5-8|=3 > d=2 For arr1[2]=8 we have: |8-10|=2

Tip: Connecting to localstack S3 using the JavaScript AWS SDK v3

I had some issues getting the v3 AWS SDK for JavaScript to communicate with localstack S3, but I found a solution! With the V2 JS SDK, the configuration object for the S3 client looks like: { "region": "eu-west-1", "endpoint": "http://localhost:4566", "s3ForcePathStyle": true } The last field tells the sdk not to use .hostname style connections, and instead puts the bucket in the path. For local..