|
|
|
задачка на интервью
|
|||
|---|---|---|---|
|
#18+
привет всем ! прилетело тут (см ниже) может у кого есть уже заготовка ? ------------------------------- Write a program in Java to assess a given string whether it complies with following patterns. Return true if a given string complies with these patterns else false. N = N1 + N2 N>= N1 >= N2 where N is the Nth element in the string or element at Nth position; N1 is the (N-1) element in the string & N2 is the (N-2) element in the string. Example 1: 224610 Elements in this string are 2, 2, 4, 6, 10. First Set: 2+2=4 (N2=2; N1=2 & N= 4); Second Set: 2+4=6 (N2=2; N1=4 & N=6); Third Set: 4+6=10 (N2=4; N1=6 & N= 10) Example 2: 1112233558 Elements in this string are 1, 11, 12, 23, 35, 58 Example 3: 1101102203 Elements in this string are 1, 101, 102, 203. This is a simple problem of recursion, which includes determination of this elements programmatically and running these patterns. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 18.03.2015, 18:10 |
|
||
|
задачка на интервью
|
|||
|---|---|---|---|
|
#18+
неужели самому не интересно решить ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 18.03.2015, 19:08 |
|
||
|
задачка на интервью
|
|||
|---|---|---|---|
|
#18+
rema174неужели самому не интересно решить хороший вопрос :) ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 18.03.2015, 20:04 |
|
||
|
задачка на интервью
|
|||
|---|---|---|---|
|
#18+
Интересно, зачем авторы задачки спрашивают о рекурсии, приделать конечно можно, но, имхо, совсем не к месту. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 18.03.2015, 22:21 |
|
||
|
задачка на интервью
|
|||
|---|---|---|---|
|
#18+
имеется ввиду парсинг выражения методом рекурсивного спуска ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 18.03.2015, 23:05 |
|
||
|
задачка на интервью
|
|||
|---|---|---|---|
|
#18+
andrew1445Elements in this string are 2, 2, 4, 6, 10. А почему не 2,2,4610? И что делать со строкой "22"? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 19.03.2015, 11:24 |
|
||
|
|

start [/forum/topic.php?fid=59&msg=38909547&tid=2125655]: |
0ms |
get settings: |
6ms |
get forum list: |
11ms |
check forum access: |
2ms |
check topic access: |
2ms |
track hit: |
28ms |
get topic data: |
7ms |
get forum data: |
4ms |
get page messages: |
32ms |
get tp. blocked users: |
1ms |
| others: | 207ms |
| total: | 300ms |

| 0 / 0 |
