Category: IT
Interval sum [a, b]
[https://telegra.ph/UniLecs-127-Intervalnaya-summa-09-16]
[code]
using System;
public class Program
{
public static long SumOfRange(long a, long b)
{
long result = (a + b) * (b – a + 1) / 2;
return result;
}
public static void Main()
{
Console.WriteLine("UniLecs");
Console.WriteLine(string.Format("Answer = {0}", SumOfRange(1, 2))); // 3
Console.WriteLine(string.Format("Answer = {0}", SumOfRange(1, 3))); // 6
Console.WriteLine(string.Format("Answer = {0}", SumOfRange(2, 4))); // 9
}
}
[/code]
Notebook
coursera – Design and Analysis of Algorithms
Android: Things every beginner should know
Things every beginner should know
1. Difference between @+id and @id
2. Using @string res for providing Strings in XML
3. Using @android and ?attr constants
4. Difference between SP and DP
5. Use of Drawables and Mipmaps
6. Using Vector Drawables
7. Setting End/Start Margin
8. Using Getter/Setter Generator
9. Using Override/Implement Generator
10. Understanding Contexts Properly