This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package utopiantree; | |
import java.util.Scanner; | |
/** | |
* | |
* @author Slava | |
* | |
* The Utopian Tree goes through 2 cycles of growth every year. Each spring, it doubles in height. | |
* Each summer, its height increases by 1 meter. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int[] inputArray = new int[10]; | |
int i = 0; | |
while (n != 0) { | |
inputArray[i] = n%10; | |
n /= 10; | |
i++; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package finddigits; | |
import java.util.Scanner; | |
/** | |
* | |
* @author Slava | |
* | |
* Given an integer, N , traverse its digits (d1,d2,...,dn) | |
* and determine how many digits evenly divide N |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Get publish settings file | |
Get-AzurePublishSettingsFile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Import publish settings | |
Import-AzurePublishSettingsFile C:\temp\azureaccount.publishsettings |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Select current azure subscription | |
Select-AzureSubscription -SubscriptionName 'Visual Studio Professional with MSDN' -Current |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Change VM instance size | |
Get-AzureVM -ServiceName slavaceorneavm1 -Name slavaceorneavm1 | | |
Set-AzureVMSize -InstanceSize ExtraSmall | | |
Update-AzureVM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float sqrtBinarySearch(n) { | |
low = 0.0; | |
high = (float)n+1; | |
while ((high-low) > 0.00001) { | |
mid = (low+high) / 2; | |
if (mid*mid < n) { | |
low = mid; | |
} | |
else { | |
high = mid; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
// Function to get absolute value of the number given by user. | |
float absolute(float num) | |
{ | |
if(num < 0){ | |
num = -num; | |
} | |
return num; | |
} | |
// Function to calculate square root of the number using Newton-Raphson method |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Watson gives two integers (A and B) to Sherlock and asks if he can count the number of square integers between A and B (both inclusive). | |
* | |
* Note: A square integer is an integer which is the square of any integer. For example, 1, 4, 9, and 16 are some of the square integers as they are squares of 1, 2, 3, and 4, respectively. | |
* | |
* Input Format | |
* The first line contains T, the number of test cases. T test cases follow, each in a new line. | |
* Each test case contains two space-separated integers denoting A and B. | |
* | |
* Output Format |