This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// What if, We want to get the specific data we need from a Json in your DB? | |
// The code below is my initial approach to it | |
DB::connection('your_db') | |
->table('your_table') | |
->select('gravity', 'bundle_date', 'DepartmentCode', 'SectionCode', 'TeamCode', 'xmlcad') | |
->where('DepartmentCode', '147') | |
->where('TeamCode', '00976') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ✨ Stable ✨ | |
function findProductPairs(prices, targetCost, maxItems) { | |
const priceMap = new Map(); | |
const pairs = []; | |
function backtrack(currentSum, currentPair, startIndex) { | |
if (currentPair.length === maxItems && currentSum === targetCost) { | |
pairs.push([...currentPair]); | |
return; | |
} |
