# Author: Kavit

## Find the kth to last element of a singly linked list

Problem description : Implement a non-recursive algorithm to find the kth to last element of a singly linked list. Input : A linked list Output : A value of a node in a linked...

## Closest pair of numbers

Problem description : Given a list of unsorted integers, find the pair of elements that have the smallest absolute difference between them? If there are multiple pairs, find them all and return them in...

## Delete a node from a linked list in javascript

Problem description : Write a method to remove a node from a linked list. Input: A linked list Output: A linked list with one less node Logic : Iterate through the list, if you...

## Remove duplicates from an unsorted linked list

Problem description : Write a method to remove duplicates from an unsorted linked list. Input : A linked list Output : A linked list with unique elements This post is a follow-up of JavaScript...

Challenge Problem : Implement LinkedList in javascript, with a following method: insertNodeAtTail – adds a node to the tail of a linked list. deleteNode – delets a node from the linked list and updates...

## Find all the prime factors for the given number

Input : A number // 10 Output : An array // [2, 5] Logic : Key here is that we need to check the divisor starting with 2 to the square root of the...

## Transform json to json

Problem description : Write a function which transforms the given JSON as shown belows : Input : Given an endorsment array with objects containing skill and user keys var endorsements = [ { skill:...

## Check if an element exists in an array, based on that update an array

Problem description : Write a function which detects if the given element exists in an array or not. If it does not exist then adds it to an array If it does exist then...

## Determine character frequency in the given string

Problem description : Create a character frequency analysis table for the given string. Input : A string // “foo bar” Output : A JSON // {” “: 1, a: 1, b: 1, f: 1,...

## Convert the given array of elements to a string

Problem description : Write a function that converts a given array into a string. Input : An Array Output : A String Logic : Iterate through array concatenate the new element into the string...