SELECT text, count(*) as 'A'
FROM all_queries
WHERE dates > LAST_DAY(CURDATE()) + INTERVAL 1 DAY - INTERVAL 1 MONTH
AND dates < DATE_ADD(LAST_DAY(CURDATE()), INTERVAL 1 DAY)
group by text
HAVING text in ('Привет','Хэллоу','Здравствуйте')
ORDER BY A desc
Min and max. Given an array of N elements, find the min and max using as few compares as possible. Brute force: find the max (N-1 compares), then find the min of the remaining elements (N-2 compares).
Solution 1. Divide and conquer: find min and max in each half (2T(N/2) compares), return min of 2 and max of 2 (2 compares). T(1) = 0, T(2) = 1, T(N) = 2T(N/2) + 2. Recurrence solution: T(N) = ceil(3N/2) - 2.
Solution 2. Divide the elements into pairs and compare two elements in each pair. Put the smallest elements in A and the largest in B. If n is odd, put element n in both A and B. This requires floor(n/2) comparisons. Now directly compute the minimum in A (ceil(n/2) - 1 comparisons) and the maximum in B (ceil(N/2) - 1) comparisons. [In fact, this is best possible.]
public class SceneObject
{
//.....
public void AddComponent<ComponentType>(Func<SceneObject, ComponentType> inst) where ComponentType : Component
{
components.Add(inst(this));
}
public static void Main(string[] args)
{
SceneObject sObj = new SceneObject();
sObj.AddComponent((a) => new Component(a) );
}
}
<button type="button" class="btn-outlined btn-lg btn-default price-button">Рассчитать стоимость</button>
<h4>Итог: <span class="cur"></span> <span class="rub">р. / м.кв.</span></h4>
.box-price {
background: #DDDDDD;
color: #333;
padding: 0 15px;
overflow: hidden;
height: 0px;
}
.box-price {
background: #DDDDDD;
color: #333;
padding: 0 15px;
overflow: hidden;
height: 390px;
}
$('.price-button').click(function() {
var boxPrice = $(this).closest('.col-md-4');
function hideButton () {
$(boxPrice).find('.price-button').hide();
$(boxPrice).find('.footer-price').append('<h4>Итог: <span class="cur"></span> <span class="rub">р. / м.кв.</span></h4>');
};
//анимация раскрытия блока с параметрами
$(boxPrice).find('.box-price').animate({height: '390px'}, {'duration': 500}, {'easing': 'linear'}, hideButton());
});
public static void main(String[] args) {
Solution2 myApp = new Solution2();
double[] numbers = new double[10];
RandomDouble sum = (arr) -> { double forSum = arr[0]; return forSum; };
RandomDouble min = (arr) -> { double forMin = arr[0]; return forMin; };
RandomDouble max = (arr) -> { double forMax = arr[0]; return forMax; };
System.out.println("Sum: " + myApp.operateBinary(numbers, sum));
System.out.println("Min: " + myApp.operateBinary(numbers, min));
System.out.println("Max: " + myApp.operateBinary(numbers, max));
}
}
public static void main(String[] args) {
//создание экземпляра и помещение ссылки на экземпляр в переменную m1
Main m1 = new Main();
//теперь через m1 есть доступ к методу nonStaticF1()
System.out.println(m1.nonStaticF1());
}