This file contains 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
const checkBalancedExpr = (expr) => { | |
let stack = []; | |
for(let i = 0; i < expr.length; i++) { | |
let char = expr[i]; | |
const brackets = ['(', ')', '[', ']', '{', '}'] | |
if(!brackets.includes(char)) { | |
continue; | |
} |
This file contains 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
// Given an unsorted array of nums containing n distinct numbers in the range [0, n], one is missed. | |
// Return the only number in the range that is missing from the array. | |
// O(N^2(Logn)) | |
const getMissingNumber = function (arr, n) { | |
arr.sort(a, b) => { | |
if(a <= b) { | |
return -1; | |
} | |
else { |
This file contains 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
// Max 3 hours per day | |
// 1.01 < movies durations < 3 | |
const durations = [1.9, 1.04, 1.25, 2.5, 1.75]; | |
const getMinDays = function (durations) { | |
var nDays = 0, startIdx = 0; | |
durations.sort() | |
for (let i = (durations.length - 1) ; i >= startIdx; i--){ | |
if(durations[i] >= 2) { |
This file contains 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
// Items | |
+ '<template v-for="h in headers" v-slot:[`item.${h.value}`]="{ item }">' | |
// ur item slot rewrite here ex {{ item[`${h.value}`] }} | |
+ '</template>' |
This file contains 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
USE [yourdatabase]; | |
GO | |
SELECT * | |
FROM sys.dm_tran_locks | |
WHERE 1=1 | |
AND resource_database_id = DB_ID() | |
AND resource_associated_entity_id = OBJECT_ID(N'dbo.yourtablename'); |
This file contains 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
USE [your_database_name] | |
GO | |
SELECT DISTINCT | |
o.name AS Object_Name, | |
o.type_desc | |
FROM sys.sql_modules m | |
INNER JOIN sys.objects o | |
ON (m.object_id = o.object_id) | |
WHERE REPLACE(UPPER(m.definition), ' ','') Like '%<search_word_here>%'; -- change by word to search |
This file contains 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
private float NumberConvert(float oldValue, float oldMinScale, float oldMaxScale, float newMinScale, float newMaxScal) | |
{ | |
float newVal = (((oldValue - oldMinScale) * (newMaxScal - newMinScale)) / (oldMaxScale - oldMinScale)) + newMinScale; | |
return newVal; | |
} |