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
    
  
  
    
  | /* | |
| Objective | |
| Today, we're learning about the Array data structure. Check out the Tutorial tab for learning materials and an instructional video! | |
| Task | |
| Given an array of integers, print 's elements in reverse order as a single line of space-separated numbers. | |
| Input Format | 
  
    
      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
    
  
  
    
  | /* | |
| Objective | |
| Today, we're learning about Key-Value pair mappings using a Map or Dictionary data structure. Check out the Tutorial tab for learning materials and an instructional video! | |
| Task | |
| Given names and phone numbers, assemble a phone book that maps friends' names to their respective phone numbers. You will then be given an unknown number of names to query your phone book for. For each queried, print the associated entry from your phone book on a new line in the form name=phoneNumber; if an entry for is not found, print Not found instead. | |
| Note: Your phone book should be a Dictionary/Map/HashMap data structure. | 
  
    
      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
    
  
  
    
  | # PowerShell Collections HashTables (Dictionaries) | |
| [Hashtable] $firstTable = @{ | |
| mykey = "myvalue" | |
| label = "value" | |
| akey = ”cat” | |
| someOtherKey = "dog" | |
| intValueKey = 123 | |
| } | 
  
    
      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
    
  
  
    
  | # Calculate Hashcode from byteArray | |
| function Get-HashcodeFromByteArray { | |
| [CmdletBinding()] | |
| Param ( | |
| [Parameter(Mandatory=$true)] | |
| [byte[]] $byteArray = $(Throw("-byteArray is required")), | |
| [ValidateSet("sha256","md5")] | |
| [string]$algorithm=("sha256") | 
  
    
      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
    
  
  
    
  | # Compress and decompress byte array | |
| function Get-CompressedByteArray { | |
| [CmdletBinding()] | |
| Param ( | |
| [Parameter(Mandatory,ValueFromPipeline,ValueFromPipelineByPropertyName)] | |
| [byte[]] $byteArray = $(Throw("-byteArray is required")) | |
| ) | |
| Process { | 
  
    
      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
    
  
  
    
  | # Create and print xml document | |
| [System.Xml.XmlDocument] $xml = | |
| @' | |
| <?xml version="1.0" encoding="UTF-8" standalone="yes"?> | |
| <root> | |
| <a><b><c><d text="Hello" /> </c></b></a> | |
| <a><b><c><d text=" " /> </c></b></a> | |
| <a><b><c><d text="World" /> </c></b></a> | |
| </root> | 
  
    
      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
    
  
  
    
  | # Date format | |
| Write-Host "Date: "( Get-Date -f 'yyyy-MM-dd HH:mm:ss' | Out-String ) | |
| Write-Host "Date: "( Get-Date -f 'dddd dd MMMM yyyy HH:mm' | Out-String ) | |
  
    
      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
    
  
  
    
  | # base64 encode / decode | |
| $bytes = [System.Text.Encoding]::UTF8.GetBytes( "Write-Host Hello World") | |
| $base64 = [Convert]::ToBase64String( $bytes ) | |
| Write-Host "Base64 encoded: "( $base64 ) | |
| $base64Decoded = [Convert]::FromBase64String( $base64 ) | |
| Write-Host "Base64 decoded: "( $base64Decoded ) | |
| $decodedText = [System.Text.Encoding]::UTF8.GetString( $base64Decoded ) | 
  
    
      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
    
  
  
    
  | # Hashtable | |
| [Hashtable] $hTable = @{ | |
| mykey = "myvalue" | |
| } | |
| Write-Host "Table: " ( $hTable | Format-Table | Out-String ) | |
| #Write-Host "Enumerator: " ( | Format-Table | Out-String ) | 
  
    
      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
    
  
  
    
  | # Generate a random Alphanumeric string | |
| Function Get-RandomAlphanumericString { | |
| [CmdletBinding()] | |
| Param ( | |
| [int] $length = 8 | |
| ) | |
| Begin{ |