language-agnostic

How can I print out all possible letter combinations a given phone number can represent?

心不动则不痛 提交于 2019-12-29 10:08:10
问题 I just tried for my first programming interview and one of the questions was to write a program that given a 7 digit telephone number, could print all possible combinations of letters that each number could represent. A second part of the question was like what about if this would have been a 12 digit international number? How would that effect your design. I don't have the code that I wrote in the interview, but I got the impression he wasn't happy with it. What is the best way to do this?

How can I print out all possible letter combinations a given phone number can represent?

夙愿已清 提交于 2019-12-29 10:07:59
问题 I just tried for my first programming interview and one of the questions was to write a program that given a 7 digit telephone number, could print all possible combinations of letters that each number could represent. A second part of the question was like what about if this would have been a 12 digit international number? How would that effect your design. I don't have the code that I wrote in the interview, but I got the impression he wasn't happy with it. What is the best way to do this?

Suggestions on starting a child programming [closed]

[亡魂溺海] 提交于 2019-12-29 10:06:56
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 8 years ago . Locked . This question and its answers are locked because the question is off-topic but has historical significance. It is not

Google Interview: Arrangement of Blocks

泄露秘密 提交于 2019-12-29 10:06:23
问题 You are given N blocks of height 1…N. In how many ways can you arrange these blocks in a row such that when viewed from left you see only L blocks (rest are hidden by taller blocks) and when seen from right you see only R blocks? Example given N=3, L=2, R=1 there is only one arrangement {2, 1, 3} while for N=3, L=2, R=2 there are two ways {1, 3, 2} and {2, 3, 1} . How should we solve this problem by programming? Any efficient ways? 回答1: This is a counting problem, not a construction problem,

What is a Flexible Array?

江枫思渺然 提交于 2019-12-29 08:57:05
问题 What is a Flexible Array, exactly? I can't find much on it. 回答1: A flexible array is an array whose index bounds are determined at run time and may change during the lifetime of the array. Java arrays are flexible. For example, in Java you can assign one array to another: int[] a1 = {1, 2, 3, 4}; int[] a2 = {1, 2, 3}; a1 = a2; At first, a1 has index range 0–3, and a2 has index range 0–2. After the assignment a1 = a2, a1 points to an array with index range 0–2, so the index range of a1 varied

Calculating the negabinary representation of a given number without loops

岁酱吖の 提交于 2019-12-29 06:59:08
问题 Could you provide a convincing explanation, or a mathematical proof, to why the following function calculates the negabinary representation of a given number? function quickNegabinary(number) { var mask = 0xAAAAAAAA; return ((number + mask) ^ mask).toString(2); } 回答1: Negabinary notation Negabinary notation uses a radix of -2. This means that, as in every number system with a negative base, every other bit has a negative value: position: ... 7 6 5 4 3 2 1 0 binary: ... 128 64 32 16 8 4 2 1

Thread Quantum?

北战南征 提交于 2019-12-29 06:42:29
问题 What is a thread quantum, and how can I identify it on my system? 回答1: Thread Quantum is the amount of time that the schedule allows a thread to run before scheduling a different thread to run. What are threads? Platform Builder: Setting the Default Thread Quantum As far as editing goes...There is a registry setting in windows that allows priority changing: HKEY_LOCAL_MACHINE / SYSTEM / CurrentControlSet / Control / PriorityControl / Win32PrioritySeparation 0 Foreground and background

All the Whitespace Characters? Is it language independent?

不问归期 提交于 2019-12-29 06:08:31
问题 I was wondering if all the language treats the same set of characters as white space charactes or is there any variation. Can anyone provide complete list of White space characters separating the one which can be entered from keyboard? If it's different, the difference and the reason would be more appropriate. Any language is helpful if you don't bring out Whitespace or its variants(if any). I certainly don't want a complete list for language like Whitespace :) 回答1: Whether a particular

All the Whitespace Characters? Is it language independent?

假如想象 提交于 2019-12-29 06:03:39
问题 I was wondering if all the language treats the same set of characters as white space charactes or is there any variation. Can anyone provide complete list of White space characters separating the one which can be entered from keyboard? If it's different, the difference and the reason would be more appropriate. Any language is helpful if you don't bring out Whitespace or its variants(if any). I certainly don't want a complete list for language like Whitespace :) 回答1: Whether a particular

small cycle finding in a planar graph

落花浮王杯 提交于 2019-12-29 05:24:07
问题 I have a geometric undirected planar graph, that is a graph where each node has a location and no 2 edges cross, and I want to find all cycles that have no edges crossing them. Are there any good solutions known to this problem? What I'm planning on doing is a sort of A* like solution: insert every edge in a min heap as a path extend the shortest path with every option cull paths that loop back to other than there start (might not be needed) cull paths that would be the third to use ang given