This question already has an answer here: How do you check whether a number is divisible by another number (Python)? 8 answers Wondering what is the most efficient way to check if an integer can or cannot be divided by another number (could be float)
I managed to check if an integer is sorted from right to left, but how can I check from left to right? Maybe I should do 2 functions, one checks from left to right and the other checks from right to left? For example, I replace return 0; with the sec
I would like to programmatically check whether a string can be pronounced or needs to be spelled out. For example, internationalization can be read out, but i18n cannot, nor can hhdirgxzf. I can think of some simple heuristics such as checking whethe
How do I check if an integer is even or odd using bitwise operatorsIn C (and most C-like languages) if (number & 1) { // It's odd }
I am trying this problem for a while but getting wrong answer again and again. number can be very large <=2^2014. 22086. Prime Power Test Explanation about my algorithm: For a Given number I am checking if the number can be represented as form of pri
I have a string which can be a number (even a float or double type, not only integer), and it can be also a word which is non-numeric. I would like to check if this string can be converted into double, and if so, then I would like to do the conversio
In PHP one can use variable variables... For example... class obj { } $fieldName = "Surname"; $object = new obj(); $object->Name = "John"; $object->$fieldName = "Doe"; echo "{$object->Name} {$object->Surname}
This question already has an answer here: Checking if a string can be converted to float in Python 9 answers Is there some function like str.isnumeric but applicable to float? '13.37'.isnumeric() #False I still use this: def isFloat(string): try: flo
This question already has an answer here: Check compatibility of a method with a given Delegate? 4 answers I create an event based system, where a class will provides bunch of events, and another class with its member method can attach to the first c
I have to find if a list can be a palindrome. The first part of my program sorts the list. A = [0, 99, 97, 97, 99, 100, 100, 0] # sorted: B = [0, 0, 97, 97, 99, 99, 100, 100] This list can be a palindrome because it can be reordered to: [0, 97, 99, 1
This question already has an answer here: How do determine if an object is locked (synchronized) so not to block in Java? 7 answers If I want to ensure exclusive access to an object in Java, I can write something like this: ... Zoo zoo = findZoo(); s
Suppose, I have two map[string]([]string) MAP1 := map[string]([]string) { "User" : []string{"11", "33"}, "Type" : []string{"A"}, } MAP2 := map[string]([]string) { "User" : []string{"11"
I have a double value that I'd like to convert into a Int32. How can I check before converting if it can be converted? Sometimes the value is undefined and the Converting into Int32 throws an OverflowException. I already tried to test it that way: do
How can I check that I can delete a file in Java? For example, if a file test.txt is opened in another program I can't delete it. And I have to know it before actual deletion, so I can't do this: if (!file.delete()) { ... } And srcFile.canWrite() is
In relation to this question on an openid issue I'm having, someone asked me to check whether my server is able to make outbound requests on port 80 and 443. Can you tell me how to verify that? The server is: Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenS