## [Solved] Find duplicate number in array and print the last duplicate number only [closed]

Simple way is iterate and compare it. like below, I hope it may solve your problem int[] a = {1,2,2,3,4,3,5,5,7}; String b = “”; int count=0; for(int i = 0; i<a.length;i++){ for(int j=0; j<a.length;j++){ if(a[i]==a[j]){ count++; } } if(count>1){ count=0; b = String.valueOf(a[i]); }else{ count = 0; } } System.out.println(“last duplicate value : ” + … Read more

## [Solved] How to know if a number is in another number python

use itertools.product to get the tuples (you will have to filter out the same number twice), then use set intersections of the digits to see if they have any digits in common. import itertools numbers = [12, 23, 26, 54] [t for t in itertools.product(numbers, numbers) if set(str(t[0])) & set(str(t[1])) and t[0] != t[1]] [(12, … Read more

## [Solved] Custom radix columns (+special characters) [closed]

How about using the basic base 10 to any base conversion, modified for custom digits: func numberToCustomRadix(_ number: Int, alphabet: String) -> String { let base = alphabet.count var number = number var result = “” repeat { let idx = alphabet.index(alphabet.startIndex, offsetBy: number % base) result = [alphabet[idx]] + result number /= base } … Read more

## [Solved] Java language – show number 1-100

Your logic to print is fine, all you need to do is to wrap the code into a for loop and excute it from 1 to 100, e.g.: for(int zmienna = 0 ; zmienna <= 100 ; zmienna++){ if (zmienna % 5 == 0 && zmienna % 3 == 0) System.out.println(“FizzBizz”); else if (zmienna % … Read more

## [Solved] This is a number guessing Python code ,but it stops after entering the first guessing number. Can you tell me where is the fault?

This is a number guessing Python code ,but it stops after entering the first guessing number. Can you tell me where is the fault? solved This is a number guessing Python code ,but it stops after entering the first guessing number. Can you tell me where is the fault?

## [Solved] C# get pair closest to value [closed]

You want something like this: public static Pair FindClosest(IEnumerable<Pair> list, int value) { Pair closest = null; if (list != null && list.Count() > 0) { foreach (var pair in list) { if (value <= pair.Max) { closest = pair; break; } } if (closest == null) { closest = list.Last(); } } return closest; … Read more

## [Solved] How can I solve this String length problem?

Have you tried calculating the length within the function rather than in the console log? This ensures that all of the logic is first completed within the function before it is returned in the console log. Your function expects the string name, but you are passing name.length function getNameLength(name){ return name.length; } console.log(getNameLength(‘John’)); console.log(getNameLength(‘Argentina!’)); console.log(getNameLength(‘Macedonia’)); … Read more

## [Solved] convert Decimal to signed 2’s compliment and vice versa in vanilla javascript

Check this out may it will help you. (function(){ var ConvertBase = function (num) { return { from : function (baseFrom) { return { to : function (baseTo) { return parseInt(num, baseFrom).toString(baseTo); } }; } }; }; // binary to decimal ConvertBase.bin2dec = function (num) { return ConvertBase(num).from(2).to(10); }; // binary to hexadecimal ConvertBase.bin2hex = … Read more

## [Solved] Increment number php every next number

You can do it that way. It works very nice. \$str =array(); for(\$i=0;\$i<10;\$i++) { for(\$j=0;\$j<10;\$j++){ \$str[]=\$i; } \$j=0; } echo implode(\$str,’,’); 2 solved Increment number php every next number

## [Solved] Finding consecutive letters in a list [closed]

def consecutiveLetters(word): currentMaxCount = 1 maxChar=”” tempCount = 1 for i in range(0, len(word) – 2): if(word[i] == word[i+1]): tempCount += 1 if tempCount > currentMaxCount: currentMaxCount = tempCount maxChar = word[i] else: currentMaxCount = 1 return [maxChar,tempCount] result = consecutiveLetters(“TATAAAAAAATGACA”) print(“The max consecutive letter is “, result[0] , ” that appears “, result[1], ” … Read more