Skip to content

Instantly share code, notes, and snippets.

View alenthomas's full-sized avatar
🏠
Working from home

Alen Thomas alenthomas

🏠
Working from home
View GitHub Profile
@alenthomas
alenthomas / tic-tac-toe.js
Last active September 19, 2017 20:31
A function which takes an array(ary) and an array of indexes(< ary.length) and sets 'X' for the for ary[indexes] else sets 'O'
// in js using for-loop
function swap(ary, indexes) {
var visited = [];
var newAry = Array(ary.length).fill(null);
for(let i=0; i<indexes.length; i++) {
newAry[indexes[i]] = 'X';
visited.push(indexes[i]);
}
for(let i=0; i<newAry.length; i++) {
if(newAry[i] === null) {
{"Category":
[{"category":"auto-driver","display":"Vehicle No"},
{"category":"shopkeeper", "display":"Shop Name"},
{"category":"medical", "display": "Medical Store Name"}]
}
}
[
{
"firstname": "Alen",
"lastname": "Thomas"
},
{
"firstname": "Alen",
"lastname": "Thomas"
},{
"firstname": "Alen",
@alenthomas
alenthomas / pyramid.py
Last active November 16, 2016 13:26
Print pyramid python
def pyramid(num):
for i in range(1, num+1):
if i == num:
for j in reversed(range(1, num+1)):
print('*'*j)
else:
print('*'*i)