Skip to content

Codewars Challenges and snippets | Technical Questions | Arrays

License

Notifications You must be signed in to change notification settings

bidyashish/codewars

Repository files navigation

Code wars | geeksforgeeks | Technical Questions | Interview Questions | Coderpad | Javascript

A list of technical questions using Javscript | js node.js

Click ⭐if you like it. Submiting Pull Request are highly appreciated. Check me @Bidyashish.


Getting Started

In order to the following example

just run eg:

node triplets-array-given-sum.js

Given an array and a value, find if there is a triplet in array whose sum is equal to the given value. If there is such a triplet present in array, then print the triplet and return true. Else return false

check triplets-array-given-sum.js.

arr=[1, 4, 45, 6, 10, 8]

sum=22

find array[a,b,c]  where a+b+c = sum

eg: From above array 4+10+8 =22
so Answers is [4,10,8]

Given an array and a value, find if there is a pairs in array whose sum is equal to the given value. If there is such a pairs present in array, then print the pairs and return true. Else return false

check pair-array-given-sum.js.

arr=[1, 4, 45, 6, 10, 8]

sum=7

find array[a,b]  where a+b = sum

eg: From above array 1+6 = 7
so Answers is [1,6]

The maximum sum subarray problem consists in finding the maximum sum of a contiguous subsequence in an array or list of integers:

Easy case is when the list is made up of only positive numbers and the maximum sum is the sum of the whole array. If the list is made up of only negative numbers, return 0 instead.

Empty list is considered to have zero greatest sum. Note that the empty list or array is also a valid sublist/subarray.

check continous-subsequence.js.


maxSequence([1, 2, 3, 4]

output: 10

Javascript Implementation of Longest Common Subsequence

Find longest common subsequence between two strings

check longest-common-subsequence.js.

String1 = AGGTAB
String2 = GXTXAYB

Result array conatining LCS is G,T,A,B
Length of result array 4
Result string GTAB


Bidyashish Kumar @Bidyashish.

LinkedIn profile: @Bidyashish.

Releases

No releases published

Packages

No packages published