Skip to main content

Posts

How to deploy angular app to github pages?

Deploying an Angular application to GitHub Pages involves building the application for production and then pushing the generated files to a specific branch in your GitHub repository. Steps to Deploy an Angular App to GitHub Pages: Create a GitHub Repository: If you don't already have one, create a new public repository on GitHub for your Angular project. Build Your Angular App for Production: Use the Angular CLI to build a production-ready version of your application. The --base-href flag is crucial for ensuring the application's assets are correctly referenced on GitHub Pages.     ng build --configuration production --base-href "https://<your-username>.github.io/<your-repo-name>/" Replace <your-username> with your GitHub username. Replace <your-repo-name> with the name of your GitHub repository.  If you are deploying to a user or organization page (e.g., username.github.io), you can omit the repository name from the base-href. Install angular-...
Recent posts

How to deploy react app to github pages?

Deploying a React app built with Vite to GitHub Pages involves several steps utilizing the gh-pages package: install gh-pages.     npm install gh-pages Configure package.json: Add the following scripts to your package.json file to automate the build and deployment process:     "scripts": {       "predeploy": "npm run build",       "deploy": "gh-pages -d dist"     } The predeploy script ensures your app is built (npm run build) before deployment, and deploy uses gh-pages to publish the contents of the dist folder to the gh-pages branch. Configure vite.config.js: Add a base option to your vite.config.js file, setting it to your GitHub repository's name (prefixed with a slash). This ensures correct asset paths on GitHub Pages. JavaScript     import { defineConfig } from 'vite';     import react from '@vitejs/plugin-react';     export default defineConfig({       plugins: [react()], ...

Poridhi: Stacks & Queues

  Stacks & Queues related problems: This collection of solutions tackles three classic problems often encountered in technical interviews and competitive programming. The Valid Parentheses problem checks whether a string has properly matched and ordered brackets using a stack. The Sliding Window Maximum efficiently finds the maximum value in every window of size k across an array using a deque, a popular sliding window pattern that ensures optimal performance. The Stock Span Problem simulates a real-world stock analysis scenario and calculates the number of consecutive days before today for which the stock price was less than or equal to today's, also utilizing a stack for efficient computation. These problems test understanding of stacks, queues, and sliding window techniques. ✅ Valid Parentheses def isValid ( s: str ) -> bool : stack = [] mapping = { ')' : '(' , '}' : '{' , ']' : '[' } for char in s: ...

Poridhi: Sorting & Searching

Sorting & Searching related problems: This blog post presents efficient Python solutions to four commonly encountered algorithmic problems that involve arrays and linked lists. It begins with the Merge Intervals problem, which focuses on combining overlapping intervals into consolidated ranges—commonly used in scheduling or time-based tasks. Next, it addresses the Find Minimum in Rotated Sorted Array, helping identify the smallest element in a rotated array using binary search. The Search in Rotated Sorted Array problem is tackled next, showing how to locate a target value even when the array has been pivoted. Finally, the post explains how to Merge Two Sorted Linked Lists, a classic linked list problem often asked in coding interviews, which involves combining two already sorted lists into one while maintaining order. Together, these solutions reinforce understanding of sorting, binary search, and linked list traversal—all essential for technical interviews and real-world developm...

Poridhi: Heaps & Priority Queues

Heaps & Priority Queues related  problems : In this blog post, we tackle three widely asked coding interview questions that revolve around the use of data structures and efficient algorithm design: Kth Largest Element in an Array, LRU Cache, and Min Stack. Each problem requires a strategic approach to managing and retrieving data under specific constraints, making them excellent practice for mastering Python collections and optimizing performance. First, the Kth Largest Element in an Array problem is a classic selection problem that can be efficiently solved using a min-heap. Instead of sorting the entire array, we maintain a heap of the k largest elements seen so far and simply return the smallest among them. This reduces time complexity and enhances performance on large datasets. Next, the LRU (Least Recently Used) Cache is a real-world inspired problem that simulates caching behavior. We use Python's OrderedDict to maintain insertion order, allowing us to quickly update rece...

Poridhi: Backtracking

Backtracking related problems: This blog covers three classic problems— Subsets , Combination Sum , and Word Search —that are efficiently solved using the backtracking technique. The Subsets problem generates all possible combinations (or power sets) of a given list, illustrating how choices can be included or excluded recursively. Combination Sum focuses on finding all unique combinations of numbers that add up to a target value, allowing repetition of elements while pruning paths that exceed the target. Finally, Word Search demonstrates how backtracking can be applied to traverse a 2D grid to determine whether a given word can be formed through sequential horizontal or vertical movements. These examples showcase the power and flexibility of backtracking in solving combinatorial and search-based problems. ✅ Subsets Problem: Generate all possible subsets (the power set) of a given list of numbers. def subsets ( nums ): res = [] def backtrack ( start, path ): res...

Poridhi: Dynamic Programming

Dynamic Programming related problems: This blog post presents Python solutions to six classic dynamic programming problems that frequently appear in coding interviews and competitive programming. These problems include strategies for maximizing profit without choosing adjacent houses in House Robber, decoding numeric strings into alphabetic representations in Decode Ways, and counting unique paths in a grid in Unique Paths. It also covers determining reachability in an array using jumps in Jump Game, finding the longest increasing subsequence in a list of numbers in Longest Increasing Subsequence, and checking if a string can be segmented into dictionary words in Word Break. Each solution is designed using efficient DP techniques such as tabulation and memorization, helping readers understand the core ideas behind dynamic problem-solving in Python. ✅ House Robber def rob ( nums ): if not nums: return 0 if len (nums) <= 2 : return max (nums) dp = [ 0 ] * len (...