FCC-learning notes DNA Pairing, fcc-pairing
FCC-Study Notes DNA Pairing
1> I recently studied and practiced FCC questions. This is really good. I recommend it to you.
2> Chinese Version address: https://www.freecodecamp.cn/?english version address: https://www.freecodecamp.org
3> This time I wrote a question about JS c
Js-FCC algorithm-full arrangement of No repeats please strings (detailed description), js-fcc-no
Rearranges the characters in a string to generate a new string, and returns the number of strings in the new string that do not contain consecutive repeated characters. continuous repetition only takes a single character as the standard.
For example, aab should return 2 because it has 6 in total (aab, aab, aba,
June 5 News, foreign media reports, according to the security vendors McAfee (McAfee) published in Wednesday, the statistical report shows that different domain names, their web site security is not the same. Among them, the. HK domain name is the least secure, and. gov is safest.
The report shows that. HK (Hong Kong, China) is the most dangerous domain name. Of all the. HK sites, 19.2% has a security threat. CN (Mainland China) second, the proport
fcc-Learning Note Convert HTML entities1> recently studied and practiced the FCC topics. This is really a good comparison, recommended to everyone.2> address of the Chinese version: https://www.freecodecamp.cn/, English version of the address: https://www.freecodecamp.org3> this time to write about a JS problem, called convert HTML entities.The rules require the following:Converts characters in a string,,,
([7,9,11,13,15],20) The return value should be 0+3+1+2 and, that is, 6.
My Code:functionpairwise (arr, arg) {if(arr.length===0){ return0; } varIdxarr=[]; Outerloop: for(vari=0;i){ if(typeofarr[i]== "Number"){ for(varj=i+1;j){ if(arr[i]+arr[j]===Arg) {Idxarr.push (i); Idxarr.push (j); Arr.splice (J,1, undefined); ContinueOuterloop; } } } } varSum=idxarr.reduce (function(A, B) {returnA +b;}); returnsum;} Pairwise ([1, 1, 1], 2);The back of the
Creates a function that accepts two or more arrays and returns an array of equivalent differential (symmetric difference) (or) of the given array △ ⊕ .
Gives two sets, such as a collectionA = {1, 2, 3}and collectionsB = {2, 3, 4}), and the mathematical term "equivalent differential" is a collection of all elements that are only one of the two sets (A △ B = C = {1, 4}). For incoming additional collections, such asD = {2, 3}), You should install the preceding principle to seek the result of the
Google is about to test the hot air balloon WiFi and has applied for a license from the FCC
Google's "Project Loon" is a Project being launched by Google X lab. Recently, according to a new file proposed by Google to the US Federal Communications Commission (FCC), Google may be preparing to test its hot air balloon for network transmission in the us next year.
According to the document, Google has appli
) (date2[1]-date1[1]>0)) | | ((date2[0]-date1[0]===1) (date2[1]-date1[1]===0) date2[2]-date1[2]>=0)){ +date2str+= "," +date2[0]; A}Else if(date1[0]==Yearnow) { theDate1str=date1str.slice (0,-6); + } - //Put two dates in the same array output (if the same day in the same month, the code date2str useless, so the code can be improved). $datearr[datearr.length]=Date1str; $ if(Date1.tostring ()!==date2.tostring ()) { -datearr[datearr.length]=Date2str; - } the returnDatearr; -}In special
); }} permall (Arr,begin); //returns the number of adjacent non-duplicates returnPerarr.filter (function(val) {return!Val.match (REG); }). Length;} Permalone (' AaB ');
First, swap the first character with the character one by one after it.
Next , the first character is fixed, and all subsequent characters are arranged. At this point we are still dividing all the characters in the back into two parts: the first character of the following character, and all the characters after the
newarr as the array arr -Miss = Newarr.filter (function(value) { + returnArr.indexof (value) = = = 1; - }); + for(vark = 0; K ) { A //Converts a number in an array to a character again, at this point in the form of an array atMISS[K] =String.fromCharCode (Miss[k]); - } - //Convert an array to a string (I consider a case where more than one letter is missing) - varletter = Miss.join (' '); - returnLetter ; -}Else { in
function can implement a combination of two arrays, newArr1 and newArr2 to form a new array.1 newArr = Newarr1.concat (NEWARR2);Code:1 functiondiff (Arr1, arr2) {2 varNEWARR = [];3 4 functionComp1 (value) {5 if(Arr2.indexof (value) = = = 1) {6 return true;7 }8 }9 Ten functionCOMP2 (value) { One if(Arr1.indexof (value) = = = 1) { A return true; - } - } the varNEWARR1 =Arr1.filter (COMP1); - varNEWARR2 =Arr2.filte
adds back), and finally returns an array of arr; knowledge Point: (1) the Array.shift () method from the arrayDeleteThe first element, and returns the value of the element. This method changes the length of the array. (2) The Array.unshift () method adds one or more elements to the beginning of the array and returns the length of the new array. Code:1 functionDrop (arr, func) {2 //Drop them elements.3 varL=arr.length;4 for(vari=0;i){5 varFir=Arr.shift ();6 if(func (FIR)) {7 Arr.unsh
Sum All PrimesSum of prime numbers less than or equal to a given number.Only 1 and its own two approximate numbers are called prime numbers. For example, 2 is a prime number, because it can only be divisible by 1 and 2. 1 is not a prime number because it can only be divisible by itself.The given number is not necessarily prime.For LoopsArray.push ()Ideas:Find all the prime numbers from 0 to num, and then iterate through the accumulation;Knowledge Points:Prime numbers are not divisible by themsel
: css () 1. Returns the CSS property (not supported by shorthand CSS properties) $ ("P"). CSS ("color"); Gets the value of the color style property of the first paragraph2. Set CSS Properties $ ("P"). CSS ("Color", "red"); Set all paragraph elements to red7. Traversal: Parent () Gets the parents of each element in the current matching element collection (traversing a single level up the DOM tree) $ ("P"). Parent (". selected"); Find the parent element with the "selected" class for each par
banknotes of uniform face value, which is added in the IF statement above to the empty array arr . theA + = 1; + fi1 (); - } $ } $ if(Odd = = 0) { - //If you can change and have the rest, return a list of changes that should be recovered - returnarr; the}Else if(Odd > 0) { - //returns the string "Insufficient Funds" if the money in the radio is not enough to find zeroWuyi return"Insufficient Funds"; the } - } Wu
"). CSS ("Color", "red"); Call the jquery method to change the CSS style of the element.9. $ ("Target1"). Prop ("Disabled", true); Call the jquery method to modify the element properties.10.$ ("Target4"). HTML ("11.$ ("Target4"). Remove (); the Remove () method removes the entire element.$ ("Target2"). AppendTo ("#right-well"); the AppendTo () method can transfer one element to another element.13.$ ("Target5"). Clone (). AppendTo ("#left-well"); the Clone () function can create a clone of an ele
for loop, but it is too cumbersome.(2) The reduce () method can operate on each element of an array, where value is the value of a single element, and sum is the cumulative value of those elements;1 var total = Arr.reduce (function (sum, value) {2 return sum + value; 3 }, 0);My Code:1 functionSumAll (arr) {2 functionGetmaxofarray (numarray) {3 returnMath.max.apply (NULL, Numarray);4 }5 6 functionGetminofarray (numarray) {7 returnMath.min.apply (NULL, Num
for (var k = 0; k ) {2 // multiply the maximum value by 1 to 100000 to load the array into the Maxarr 3 Maxarr.push (Max * (k + 1)); 4 }Code:1 functionsmallestcommons (arr) {2 varNEWARR = [];3 varMaxarr = [];4 varnum = 1;5 varmax = Math.max.apply (NULL, arr);6 varmin = Math.min.apply (NULL, arr);7 8 9 for(vark = 0; K ) {Ten //multiply the maximum value by 1 to 100000 to load the array into the Maxarr OneMaxarr.push (Max * (k + 1)); A } -
Everything be TrueAll the things are true!Refine the Every function in the editor if all objects in the collection (collection) have corresponding properties (pre), and the property (pre) corresponds to a value of true. The function returns ture. Conversely, returns false.Remember: You can only access the object's variable properties (pre) through the brackets.Array.prototype.every ().Knowledge Point: The Array.prototype.every () method tests whether all elements of an array pass the test of the
Binary AgentsPass in the binary string, translate into English sentences and return.Binary strings are separated by a space.String.charcodeat ()String.fromCharCode ()Ideas:(1) Convert strings into arrays;(2) Convert binary into decimal in array;(3) Convert the decimal digits in the array into letters;(4) Convert the array into a string;Knowledge points(1) the String.Split () 方法将一个 String object is segmented into a string array, and 通过 the string is divided into substrings;(2) parseint (string,nu
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.