Leetcode - 205. Isomorphic Strings
DescriptionGiven two strings s and t, determine if they are isomorphic. Two strings s and t are isomorphic if the characters in s can be replaced to get t. All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same character, but a character may map to itself. Approach12345678910111213141516class Solution: def isIsomorphic(self, s: str, t: str) -> bool: char_index_s = {} c...
Leetcode - 392. Is Subsequence
DescriptionGiven two strings s and t, return true if s is a subsequence of t, or false otherwise.A subsequence of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i.e., “ace” is a subsequence of “abcde” while “aec” is not). Example 1: 12Input: s = "abc", t = "ahbgdc"Output: true Example 2: 12Input: s = "axc", t = "ahbgdc&qu...
interview question of Java Backend
Interview QuestionsCore Java (OOPs, Collections, Concurrency Basics)Explain difference between HashMap, HashTable, and ConcurrentHashMap. Feature HashMap Hashtable ConcurrentHashMap Thread Safety Not thread-safe Thread-safe (synchronized methods) Thread-safe (lock segmentation / fine-grained locking) Null Keys/Values Allows one null key and multiple null values Does not allow any null keys/values Does not allow null keys/values Performance Faster (no synchronization overhead) Slowe...
terraform
TerraformDocumentationterraform TofuDocumentationtofu
interview question of anthrapic
Question 1: Concurrent Web Crawler ImplementationDesign and implement a multi-threaded web crawler that efficiently crawls a specific domain and counts unique URLs Requirements: Handle circular references and invalid URLs implement rate limiting and exponential back off Process robots.txt compliance Support different URL schemes and redirects Optimize for memory usage with large datasets Overview12345678910111213141516171819[Seed URLs] | [Frontier in-memory queue] <--- [Persistent ov...
Docker Compose Install Postgres
Installing Postgres using Docker Compose1234567891011121314151617version: "3.9"services: postgres: image: postgres:13.22-trixie container_name: postgres_13 restart: always environment: POSTGRES_USER: root POSTGRES_PASSWORD: root POSTGRES_DB: mydb ports: - "5432:5432" volumes: - ./data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U root"]
Docker Compose Install Mysql
Installing Mysql using Docker Compose12345678910111213141516version: '3'services: mysql: image: mysql:8.0.18 container_name: mysql8 environment: - MYSQL_ROOT_PASSWORD=root# - TZ=Asia/Shanghai volumes: - ./log:/var/log/mysql - ./data:/var/lib/mysql - ./conf/conf.d:/etc/mysql/conf.d # - /etc/localtime:/etc/localtime:ro ports: - 3306:3306 restart: always
Docker Compose Install MongoDB
Installing MongoDB using Docker Compose1234567891011121314151617181920212223242526version: "3.8"services: mongodb: image: mongo container_name: mongodb ports: - 27017:27017 volumes: - ./database:/data/db environment: - MONGO_INITDB_ROOT_USERNAME=admin - MONGO_INITDB_ROOT_PASSWORD=adminpwd # mongo-express: # image: mongo-express # container_name: mongo-express # restart: always # ports: # - 8081:8081 # environment: # - ME_...
docker install DVWA
Installing DVWA using DockerInstall the Damn Vulnerable Web Application (via a Docker container) quite easily, as it will take care of all the dependencies required (e.g. mySQL). Open a terminal within your Ubuntu instance. Install DVWA with the following command: sudo docker run —restart always -p 80:80 vulnerables/web-dvwa DVWA should now be installed and running. To access it, open up Firefox and browse to your localhost address. In other words, in the URL toolbar (where you type in URLs)...
Fix "Unable to locate package docker-compose-plugin" on Ubuntu
Install Docker Compose on UbuntuWhen trying to install Docker Compose with the command: 1sudo apt install docker-compose-plugin you might encounter the following error:1234Reading package lists... DoneBuilding dependency tree... DoneReading state information... DoneE: Unable to locate package docker-compose-pluginThis happens because the default Ubuntu repositories don’t include the latest Docker packages. To fix it, you need to enable the official Docker repository first. Solution Remove old...






