2574. Left and Right Sum Differences

You are given a 0-indexed integer array nums of size n. Define two arrays leftSum and rightSum where: leftSum[i] is the sum of elements to the left of the index i in the array nums. If there is no such element, leftSum[i] = 0. rightSum[i] is the sum of elements to the right of the index i in the array nums. If there is no such element, rightSum[i] = 0. Return an integer array answer of size n where answer[i] = |leftSum[i] - rightSum[i]|.
/**
 * @param {number[]} nums
 * @return {number[]}
 */
var leftRightDifference = function(nums) {
  const n = nums.length;
  const ans = new Array(n);   // final result array

  // Compute the total sum once.
  // This lets us derive the right-side sum on the fly.
  let total = 0;
  for (let x of nums) total += x;

  let left = 0;  // running sum of elements to the left of i

  for (let i = 0; i < n; i++) {
    // Right sum is everything except:
    // - the left portion we've already accumulat

prompt

A complex, vintage Chicano tattoo-style graphic composition featuring a large menacing skull wearing aviator sunglasses and a snapback cap reading 'Nawf Side'. Below the skull is elaborate, ornate gothic typography reading 'TRILLA THAN THA REST' intertwined with decorative flowing ribbons. At the base sits a classic 90s luxury lowrider sedan with wire spoke wheels, flanked by stacks of hundred dollar bills, a smoking double styrofoam cup, a giant faceted diamond, and a smaller skull resting on a

prompt

A complex, vintage Chicano tattoo-style graphic composition featuring a large menacing skull wearing aviator sunglasses and a snapback cap reading 'Nawf Side'. Below the skull is elaborate, ornate gothic typography reading 'TRILLA THAN THA REST' intertwined with decorative flowing ribbons. At the base sits a classic 90s luxury lowrider sedan with wire spoke wheels, flanked by stacks of hundred dollar bills, a smoking double styrofoam cup, a giant faceted diamond, and a smaller skull resting on a

3753. Total Waviness of Numbers in Range II

You are given two integers num1 and num2 representing an inclusive range [num1, num2]. The waviness of a number is defined as the total count of its peaks and valleys: A digit is a peak if it is strictly greater than both of its immediate neighbors. A digit is a valley if it is strictly less than both of its immediate neighbors. The first and last digits of a number cannot be peaks or valleys. Any number with fewer than 3 digits has a waviness of 0. Return the total sum of waviness for all numbers in the range [num1, num2].
/**
 * @param {number} num1
 * @param {number} num2
 * @return {number}
 */
var totalWaviness = function (num1, num2) {
    return solve(num2) - solve(num1 - 1);

    function solve(n) {
        if (n < 0) return 0;

        const s = String(n);
        const len = s.length;
        const memo = new Map();

        // Returns: { waviness, count }
        function dfs(pos, tight, last, secondLast) {
            const key = pos + "," + tight + "," + last + "," + secondLast;
            if (memo.ha

fix blog image

jQuery(document).ready(function () {
  jQuery('.blog-posts picture source, .blog-posts picture img').each(function () {
    var $el = jQuery(this);

    function fixPath(val) {
      if (!val) return val;
      return val.replace(
        /\/files\/styles\/[^/]+\/public\/images\/([^\s?]+?)(?:\?[^\s]*)?(\s+\d+x)?$/g,
        function (match, filename) {
          var clean = filename.replace(/^(.+\.\w+)\.webp$/, '$1');
          return '/files/images/' + clean;
        }
      );
    }

    var s

Remove pyc files and empty folders

# Remove all .pyc files, except the ones in .venv folder
# Preview
find . -type d -name '.venv' -prune -o -type f -name '*.pyc' -print
# Delete
find . -type d -name '.venv' -prune -o -type f -name '*.pyc' -exec rm -f {} +

PWD_REWRITE

Building the V1 Agent‑Powered Agency Platform
Introduction

This document outlines the architecture and implementation plan for Version 1 of the AI‑powered design/development agency platform. The goal is to deliver a reliable, maintainable prototype that demonstrates how specialized agents can work together to perform research, generate strategy documents and code, and handle client outreach. The plan emphasises a simple orchestration model rather than complex distributed coordination so the sys

Model Development Cheatsheet

Linear Regression
  from sklearn.linear_model import
  LinearRegression
  lr = LinearRegression()
  
Train Linear Regression model
  X = df[['attribute1','attribute2']]
  Y = df['target_attribute']
  lr.fit(X,Y)
Output predicitons
  Y_hat = lr.predict(X)
  
Identify the coefficient and intercept
  coeff = lr.coef
  intercept = lr.intercept_
  
Residual Plot
  import seanorn as sns
  sns.residualplot(x=df['attribute1'], y=df['attribute2'])
  
Distribution Plot
  import seaborn as sns
  sns.displo

3751. Total Waviness of Numbers in Range I

You are given two integers num1 and num2 representing an inclusive range [num1, num2]. The waviness of a number is defined as the total count of its peaks and valleys: A digit is a peak if it is strictly greater than both of its immediate neighbors. A digit is a valley if it is strictly less than both of its immediate neighbors. The first and last digits of a number cannot be peaks or valleys. Any number with fewer than 3 digits has a waviness of 0. Return the total sum of waviness for all numbers in the range [num1, num2].
/**
 * @param {number} num1
 * @param {number} num2
 * @return {number}
 */
var totalWaviness = function(num1, num2) {
    // This will accumulate the total waviness across the entire range.
    let total = 0;

    // Iterate through every number in the inclusive range [num1, num2].
    for (let n = num1; n <= num2; n++) {

        // Convert the number to a string so we can easily access its digits.
        const s = String(n);
        const len = s.length;

        // Numbers with fewer than 3

SharePoint - Audit Site Owners

# === CONFIGURATION ===
$AdminSiteUrl = "https://westernssmokehouse-admin.sharepoint.com"
$ClientId     = "715390fe-65ce-48b0-ad72-081abb196164"
$ExportPath   = "C:\Users\Public\Downloads\SiteOwners_$(Get-Date -Format 'yyyyMMdd_HHmmss').csv"

# === CONNECT TO SHAREPOINT ADMIN CENTER ===
Connect-PnPOnline -Url $AdminSiteUrl -Interactive -ClientId $ClientId

# === GET ALL SITE COLLECTIONS ===
Write-Host "Retrieving all site collections..." -ForegroundColor Cyan
$Sites = Get-PnPTenantSite

Turbo Frames & Streams

## TURBO FRAMES
- A frame, or designated area, that will respond to a click that **renders** a response
(usually HTML)
- Create the turbo frame:
```rb
# views/model/some_page.html.erb
<%= turbo_frame_tag('some-identifier') do %>
  <%= render partial: '...', locals: { } %>
<% end %>
```
- The above text snippet will respond to a request: for example:
  - If you click on a link that routes to the `show` action, instead of the action
taking you to the show page, turbo takes the `html` returned from

Database Encryption

## Database Encryption Rails 8 App

- Secure database using: `bin/rails db:encryption:init`
- Edit and add the keys from the above command to your credential file: 
  - `EDITOR="code --wait" rails credentials:edit`

### Useage
- In `model.rb`, add `encrypts :attribute` to encrypt the attribute

### Viewing
- If the db gets compromised, this is what the hacker will see:
```
INSERT INTO "entries" 
(... '{"p":"lPJmyUnvP1gW9D2SAdVURF0=",
"h":{"iv":"sndLY4XcPzRFCbRl","at":"A62cIuZQYG8qSwzrokLixA=="}}

3635. Earliest Finish Time for Land and Water Rides II

You are given two categories of theme park attractions: land rides and water rides. Land rides landStartTime[i] – the earliest time the ith land ride can be boarded. landDuration[i] – how long the ith land ride lasts. Water rides waterStartTime[j] – the earliest time the jth water ride can be boarded. waterDuration[j] – how long the jth water ride lasts. A tourist must experience exactly one ride from each category, in either order. A ride may be started at its opening time or any later moment. If a ride is started at time t, it finishes at time t + duration. Immediately after finishing one ride the tourist may board the other (if it is already open) or wait until it opens. Return the earliest possible time at which the tourist can finish both rides.
/**
 * @param {number[]} landStartTime
 * @param {number[]} landDuration
 * @param {number[]} waterStartTime
 * @param {number[]} waterDuration
 * @return {number}
 */
var earliestFinishTime = function(landStart, landDur, waterStart, waterDur) {
    function solve(Astart, Adur, Bstart, Bdur) {
        const n = Astart.length, m = Bstart.length;

        // Build B rides sorted by start time
        let B = [];
        for (let i = 0; i < m; i++) B.push([Bstart[i], Bdur[i]]);
        B.sort((a, b

Stimulus Controller

## Using a Stimulus Controller in Rails 8 Web App
### Create Stimulus Controller
- In `app/javascript/controllers/`, create a new controller:
```js
// toast_controller.js

import { Controller } from "@hotwired/stimulus"

class ToastController extends Controller {
  connect() {
    console.log("Hello from toast!")
  }
}

export default ToastController
```
- The `connect()` method is provided by stimulus as as lifecyle method and is
invoked anytime the controller is connected to the DOM

### Regis

git仓库tokens

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

3633. Earliest Finish Time for Land and Water Rides I

You are given two categories of theme park attractions: land rides and water rides. Land rides landStartTime[i] – the earliest time the ith land ride can be boarded. landDuration[i] – how long the ith land ride lasts. Water rides waterStartTime[j] – the earliest time the jth water ride can be boarded. waterDuration[j] – how long the jth water ride lasts. A tourist must experience exactly one ride from each category, in either order. A ride may be started at its opening time or any later moment. If a ride is started at time t, it finishes at time t + duration. Immediately after finishing one ride the tourist may board the other (if it is already open) or wait until it opens. Return the earliest possible time at which the tourist can finish both rides.
/**
 * @param {number[]} landStartTime  – earliest start times for land rides
 * @param {number[]} landDuration   – durations for land rides
 * @param {number[]} waterStartTime – earliest start times for water rides
 * @param {number[]} waterDuration  – durations for water rides
 * @return {number}                 – earliest possible finish time
 */
var earliestFinishTime = function(landStartTime, landDuration, waterStartTime, waterDuration) {
    let ans = Infinity; // Track the minimum finish