1096. Brace Expansion II

Under the grammar given below, strings can represent a set of lowercase words. Let R(expr) denote the set of words the expression represents. The grammar can best be understood through simple examples: Single letters represent a singleton set containing that word. R("a") = {"a"} R("w") = {"w"} When we take a comma-delimited list of two or more expressions, we take the union of possibilities. R("{a,b,c}") = {"a","b","c"} R("{{a,b},{b,c}}") = {"a","b","c"} (notice the final set only contains each word at most once) When we concatenate two expressions, we take the set of possible concatenations between two words where the first word comes from the first expression and the second word comes from the second expression. R("{a,b}{c,d}") = {"ac","ad","bc","bd"} R("a{b,c}{d,e}f{g,h}") = {"abdfg", "abdfh", "abefg", "abefh", "acdfg", "acdfh", "acefg", "acefh"} Formally, the three rules for our grammar: For every lowercase letter x, we have R(x) = {x}. For expressions e1, e2, ... , ek with k >= 2, we have R({e1, e2, ...}) = R(e1) ∪ R(e2) ∪ ... For expressions e1 and e2, we have R(e1 + e2) = {a + b for (a, b) in R(e1) × R(e2)}, where + denotes concatenation, and × denotes the cartesian product. Given an expression representing a set of words under the given grammar, return the sorted list of words that the expression represents.
/**
 * @param {string} expression
 * @return {string[]}
 */
var braceExpansionII = function(expression) {

    // Helper: concatenates two sets of strings (cartesian product)
    function concat(set1, set2) {
        // If one side is empty, concatenation behaves like the other side
        if (set1.size === 0) return set2;
        if (set2.size === 0) return set1;

        const res = new Set();
        for (let a of set1) {
            for (let b of set2) {
                res.add(a + b); // c

Rename a Branch locally and globally

git checkout x
git branch -m y
git push -u origin y
git push origin --delete x
git fetch --prune

Transfer uncommited changes from one Branch to another

# On branch x
git stash
# Switch to target branch
git checkout y
# Apply saved changes
git stash pop
git add .
git commit -m"x to y"

tutorial redis con docker


Bajo la imagen alpine para que ocupe menos

docker pull redis:alpine3.19

corro el contenedor, si quiero que sea como demonio agrego -d

docker run --name mi_redis -p 6379:6379 redis:alpine3.19


para conectar con el docker en linea de comando como es alpine es asi:

docker exec -it mi_redis sh

para entrar al cli del redis

redis-cli

Ahora puedo ejecutar consultas en el redis

muestro todas las claves
keys *

creo una clave
set saludo "Hola soy Flash desde Redis"

consulto una clave
get salud

3550. Smallest Index With Digit Sum Equal to Index

You are given an integer array nums. Return the smallest index i such that the sum of the digits of nums[i] is equal to i. If no such index exists, return -1.
/**
 * @param {number[]} nums
 * @return {number}
 */
var smallestIndex = function(nums) {
    // Helper function to compute the digit sum of a number
    const digitSum = (x) => {
        let sum = 0;
        // Extract digits one by one
        while (x > 0) {
            sum += x % 10;          // Add last digit
            x = Math.floor(x / 10); // Remove last digit
        }
        return sum;
    };

    // Scan from left to right to find the smallest index
    for (let i = 0; i < nums.l

1658. Minimum Operations to Reduce X to Zero

You are given an integer array nums and an integer x. In one operation, you can either remove the leftmost or the rightmost element from the array nums and subtract its value from x. Note that this modifies the array for future operations. Return the minimum number of operations to reduce x to exactly 0 if it is possible, otherwise, return -1.
/**
 * @param {number[]} nums
 * @param {number} x
 * @return {number}
 */
var minOperations = function(nums, x) {
    // Total sum of the array
    const total = nums.reduce((a, b) => a + b, 0);

    // We want to KEEP a subarray whose sum is total - x.
    // Everything outside that subarray is removed.
    const target = total - x;

    // If target is 0, we must remove all elements.
    if (target === 0) return nums.length;

    let left = 0;
    let curr = 0;
    let maxLen = -1; // longest

3525. Find X Value of Array II

You are given an array of positive integers nums and a positive integer k. You are also given a 2D array queries, where queries[i] = [indexi, valuei, starti, xi]. You are allowed to perform an operation once on nums, where you can remove any suffix from nums such that nums remains non-empty. The x-value of nums for a given x is defined as the number of ways to perform this operation so that the product of the remaining elements leaves a remainder of x modulo k. For each query in queries you need to determine the x-value of nums for xi after performing the following actions: Update nums[indexi] to valuei. Only this step persists for the rest of the queries. Remove the prefix nums[0..(starti - 1)] (where nums[0..(-1)] will be used to represent the empty prefix). Return an array result of size queries.length where result[i] is the answer for the ith query. A prefix of an array is a subarray that starts from the beginning of the array and extends to any point within it. A suffix of an array is a subarray that starts at any point within the array and extends to the end of the array. Note that the prefix and suffix to be chosen for the operation can be empty. Note that x-value has a different definition in this version.
/**
 * @param {number[]} nums
 * @param {number} k
 * @param {number[][]} queries
 * @return {number[]}
 */
var resultArray = function(nums, k, queries) {
    const n = nums.length;

    // Node structure:
    // {
    //   freq: Array(k).fill(0),
    //   total: number (product % k)
    // }

    // Build segment tree
    const size = 1 << (Math.ceil(Math.log2(n)) + 1);
    const tree = Array(size);

    function build(idx, l, r) {
        if (l === r) {
            const val = nums[l] % k;
   

SOC

# Systèmes d'organisation des connaissances pour bases interrogeables par des agents IA

*Illustré par le domaine de l'octroi de crédit*

---

## 1. La thématique : les systèmes d'organisation des connaissances (SOC)

### 1.1 Définition

Un **système d'organisation des connaissances** (SOC, en anglais *Knowledge Organization System*, KOS) est un dispositif explicite et gouverné qui fixe **le vocabulaire d'un domaine, les relations entre ses termes, et éventuellement les règles qui contraignent c

ampersand update helper

cd /path/to/magento2/
composer install
mv vendor/ vendor_orig/

# Update to new version (example)
composer require magento/product-community-edition 2.4.8 --no-update
composer update magento/product-community-edition --with-dependencies

# Generate the patch
diff -ur -N vendor_orig/ vendor/ > vendor.patch   

git clone https://github.com/AmpersandHQ/ampersand-magento2-upgrade-patch-helper
cd ampersand-magento2-upgrade-patch-helper
composer install

# Analyze the project (replace with your patch 

Partial Page view

--1. Create new master page.
--2. Create new partial pages same as master page. just write their name using underscore(_) for good practice & to defferentiate.
--3. Then follow the below steps. (You can show-hide any page using div id.):

--In HTML:

@{
    int? batchId = null;
    if (ViewBag.Id != null)
    {
        batchId = ViewBag.Id;
    }
}
@await Html.PartialAsync("_rptInvoicePkL")

<div class="pageBreak"></div>
<div id="DetailsPackingList">
@await Html.PartialAsync("_rptDetailsPackingL

3524. Find X Value of Array I

You are given an array of positive integers nums, and a positive integer k. You are allowed to perform an operation once on nums, where in each operation you can remove any non-overlapping prefix and suffix from nums such that nums remains non-empty. You need to find the x-value of nums, which is the number of ways to perform this operation so that the product of the remaining elements leaves a remainder of x when divided by k. Return an array result of size k where result[x] is the x-value of nums for 0 <= x <= k - 1. A prefix of an array is a subarray that starts from the beginning of the array and extends to any point within it. A suffix of an array is a subarray that starts at any point within the array and extends to the end of the array. Note that the prefix and suffix to be chosen for the operation can be empty.
/**
 * @param {number[]} nums
 * @param {number} k
 * @return {number[]}
 */
var resultArray = function(nums, k) {
    const result = Array(k).fill(0);
    let dp = Array(k).fill(0);  // dp[r] = count of subarrays ending at previous index with remainder r

    for (let num of nums) {
        const mod = num % k;
        const new_dp = Array(k).fill(0);

        // Extend previous subarrays
        for (let r = 0; r < k; r++) {
            if (dp[r] > 0) {
                const nr = (r * mod) % k

Graphs

- BFS, DFS - 0-1 BFS - Flood Fill - DSU - Topo Sort - SCC : Kosaraju - Bridges - Articulation Points - Dijkstra - Bellman Ford - Floyd Warshall - Bidirectional BFS - Prim
// BFS //
vector<bool> visited(V, false);
vector<int> res;

queue<int> q;

int src = 0;
visited[src] = true;
q.push(src);

while (!q.empty()) 
{
    int curr = q.front();
    q.pop();
    res.push_back(curr);

    for (int x : adj[curr]) 
    {
        if (!visited[x]) 
        {
            visited[x] = true;
            q.push(x);
        }
    }
}

return res;
 
// DFS //
visited[s] = true;
res.push_back(s);

for (int i : adj[s])
  if (visited[i] == false)
  {
    dfsRec(adj, visited, i, res)

3498. Reverse Degree of a String

Given a string s, calculate its reverse degree. The reverse degree is calculated as follows: For each character, multiply its position in the reversed alphabet ('a' = 26, 'b' = 25, ..., 'z' = 1) with its position in the string (1-indexed). Sum these products for all characters in the string. Return the reverse degree of s.
/**
 * @param {string} s
 * @return {number}
 */
var reverseDegree = function(s) {
    let total = 0;

    // Loop through each character in the string
    for (let i = 0; i < s.length; i++) {

        // Convert 0‑indexed position to 1‑indexed (required by the problem)
        const posInString = i + 1;

        // Compute reversed alphabet index:
        // 'a' → 26, 'b' → 25, ..., 'z' → 1
        // charCodeAt gives ASCII code; subtract 97 to get 0–25 range
        const reversedAlphaIndex = 

skillspector 安裝

以下是為 [NVIDIA SkillSpector](https://github.com/nvidia/skillspector) **安裝與使用完整 SOP** 。這份指南已將「無配置本地大模型(`--no-llm` 模式)」作爲預設設定,確保您能在本地完全免費、極速地完成安全檢查。 [1, 2] 
------------------------------
# 🛠️ 第一階段:安裝工具 (二選一)

根據您電腦目前的環境,選擇 方法 A(推薦:最快) 或 方法 B(傳統虛擬環境)。 [3] 

## 方法 A:使用 `uv` 快速安裝(最推薦,免環境設定)

如果您電腦有安裝 Astral 出品的高效率 Python 管理工具 `uv`,請直接在終端機(Terminal)輸入一行指令: [3] 

```bash
uv tool install git+https://github.com/NVIDIA/skillspector.git
```

(未來想升級時,只需輸入:uv tool update skillspector) [3] 

##

1401. Circle and Rectangle Overlapping

You are given a circle represented as (radius, xCenter, yCenter) and an axis-aligned rectangle represented as (x1, y1, x2, y2), where (x1, y1) are the coordinates of the bottom-left corner, and (x2, y2) are the coordinates of the top-right corner of the rectangle. Return true if the circle and rectangle are overlapped otherwise return false. In other words, check if there is any point (xi, yi) that belongs to the circle and the rectangle at the same time.
/**
 * @param {number} radius
 * @param {number} xCenter
 * @param {number} yCenter
 * @param {number} x1
 * @param {number} y1
 * @param {number} x2
 * @param {number} y2
 * @return {boolean}
 */
var checkOverlap = function(radius, xCenter, yCenter, x1, y1, x2, y2) {
    // Find the closest point on the rectangle to the circle center
    let closestX = Math.max(x1, Math.min(xCenter, x2));
    let closestY = Math.max(y1, Math.min(yCenter, y2));

    // Compute squared distance
    let dx = close