Gerga

Gerga
Рейтинг
94
Регистрация
02.08.2015

a linear version https://pastebin.com/QJvnxc1A , but still far from the best solutions to php ..

png 1.png

danforth, ну да, если так, тогда этот фильтр не поможет...

Danforth, yes, if so, then this filter will not help ...

danforth, учел 0 и отрицательное число https://pastebin.com/JDPYysWF.

Danforth, took into account the 0 and a negative number https://pastebin.com/JDPYysWF .

tommy-gung:
Gerga, ты выкидываешь все ,что больше $target? а как же сумма с отрицательным числом?

можно добавить проверку на отрицательное число и фильтровать в обратную сторону, но все равно это однозначно быстрее, чем без подобного фильтра.

tommy-gung:
Gerga, you have to throw out all that great $ target? as well as the same amount with a negative number?

you can add a check for a negative number and filter in the opposite direction, but it is still clearly faster than without such a filter.

danforth:
Решения кидайте прямо сюда, желательно ссылками на pastebin, чтобы не палить спойлеры с решениями.
У меня получилось две реализации, первую написал "в тупую", вторую - оптимизировал.

Пример реализации на php https://pastebin.com/xxQ1TZ10

Danforth:
Solutions throw right here, it is desirable to link to pastebin, so as not to scorch spoilers with solutions.
I got two implementations, the first written "in a dull", the second - optimized.

EXAMPLE implementation on php https://pastebin.com/xxQ1TZ10

SeVlad, насколько я понял, речь идет не про url, а про поле названия темы.

Всего: 811