Skip to content

Instantly share code, notes, and snippets.

View gani88's full-sized avatar
:electron:

Galgani gani88

:electron:
View GitHub Profile
@gani88
gani88 / QueryParent.sql
Created June 12, 2024 09:51
SQL : Self Join to query parent name
-- Creating Table
CREATE TABLE CensusPeople (
id serial primary key,
name varchar,
parent_id int
);
-- Inserting Data
INSERT INTO CensusPeople (id, name, parent_id)
VALUES (1, 'Zaki', 2),
@gani88
gani88 / anagram.js
Created June 12, 2024 09:49
Anagram : Grouping words to two dimensional array based on anagram of word
function anagram(arr) {
const forAnagram = {};
// Creating function to place element/characters into specific index in some string
function insertElement(word, idx, element) {
let newString = '';
for (let i = 0; i < word.length; i++) {
if (i === idx) {
newString += element;