Deoxyribonucleic acid (DNA) is a chemical found in the nucleus of cells and carries the "instructions"for the development and functioning of living organisms.
If you want to know more http://en.wikipedia.org/wiki/DNA
In DNA strings, symbols "A"and"T" are complements of each other, as "C"and"G". You have functionwith one side of the DNA (string, except for Haskell); you need to get the other complementary side. DNA strand is never empty or there is no DNA at all (again, except for Haskell).
DNAStrand ("ATTGC") # return"TAACG"
DNAStrand ("GTAT") # return"CATA"
Story
Peter lives on a hill, and he always moans aboutthe way to his home. "It's always just up. I never get a rest". But you're pretty sure thatat least at one point Peter's altitude doesn't rise, but fall. To get him, you use a nefarious plan: you attach an altimeter to his backpack and you readthe data from his way backatthe next day.
Task
You're given a listof compareable elements:
heights = [h1, h2, h3, …, hn]
Your job isto check whether for any x all successors are greater orequalto x.
isMonotone([1,2,3]) == true
isMonotone([1,1,2]) == true
isMonotone([1]) == true
isMonotone([3,2,1]) == false
isMonotone([3,2,2]) == false
If thelistis empty, Peter has probably removed your altimeter, so we cannot prove him wrong and he's still right:
isMonotone([]) == True
//No.1var isMonotone = function(arr){
}
//No.2var isMonotone = function(arr){for (var i = 0; i < arr.length-1; i++) {
if (arr[i]>arr[i+1]) {returnfalse};
}
returntrue;
}
isMonotone([1,2,3]);
3.Showing X to Y of Z Products.
A category page displays a setnumberof products per page, with pagination atthe bottom allowing the user to move from page to page.
Given that you know the page you are on, how many products are inthe category in total, and how many products are on any given page, how would you output a simple string showing which products you are viewing..
examples
In a category of30 products with10 products per page, on page 1 you would see
'Showing 1to10of30 Products.'
In a category of26 products with10 products per page, on page 3 you would see
'Showing 21to26of26 Products.'
In a category of8 products with10 products per page, on page 1 you would see
'Showing 1to8of8 Products.'
//My:
var paginationText = function(pageNumber, pageSize, totalProducts){
var a="Showing ";
console.log((pageNumber-1)*pageSize+1);
a+=(pageNumber-1)*pageSize+1;
a+=' to ';
if (pageNumber*pageSize < totalProducts) {
console.log(pageNumber*pageSize);
a+=pageNumber*pageSize;
}else {
console.log(totalProducts);
a+=totalProducts;
}
a+=" of";
a+=totalProducts;
a+=" Products";
return a;
}