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
| class StackQueue{ | |
| Stack<int> st1 = new Stack<int>(); | |
| Stack<int> st2 = new Stack<int>(); | |
| //Complete the functions | |
| public void Push(int x){ | |
| while(st2.Count>0){ | |
| st1.Push(st2.Pop()); | |
| } | |
| st1.Push(x); |
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
| public bool isAnagram(string a, string b) | |
| { | |
| if(a.Length != b.Length){ | |
| return false; | |
| } | |
| //Your code here | |
| var aDict = new Dictionary<char,int>(); | |
| var bDict = new Dictionary<char,int>(); | |
| var aArr = a.ToCharArray(); | |
| var bArr = b.ToCharArray(); |
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
| public int findPlatform(int[] arr, int[] dep,int n) | |
| { | |
| //code here | |
| Array.Sort(arr); | |
| Array.Sort(dep); | |
| var noOfPlatforms = 0; | |
| var i = 0; | |
| var j = 0; |
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
| public int majorityElement(int[] a, int size) | |
| { | |
| //code here | |
| var majorElement = -1; | |
| var majorElementCount = new Dictionary<int,int>(); | |
| for (int i = 0;i<size;i++){ | |
| if(majorElementCount.ContainsKey(a[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
| ls | Rename-Item -NewName {$_.name -replace "OLD-FILE-NAME-PART","NEW-FILE-NAME-PART"} |
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
| #copying | |
| Write-Host "Copying charts.." | |
| Copy-Item "sorceaddress" -Destination "destaddress" -Recurse | |
| $todayDate = Get-Date -UFormat "%Y%m%d" | |
| #rename file | |
| Rename-Item sourcefile.CSV newname.CSV | |
| $pinfo = New-Object System.Diagnostics.ProcessStartInfo |
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
| Table can be dropped even when there is a view on it. There is no warning. | |
| The associated view just becomes invalid when underlying table is dropped. | |
| Solution is to create a view "WITH SCHEMABINDING" option, which will give a warning, if there is any change in underlying table. |
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
| robocopy source destination /MOVE (delete from source) /E (all sub dirs and files) |
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
| let userRValue = toastr.warning("This query name already exists. Query will be saved as name_copy. <br /><button type='button' value='yes' class='btn clear'>Yes</button><button type='button' value='no' >No</button>", | |
| 'Are you sure to continue?', | |
| { | |
| allowHtml: true, | |
| timeOut: 0, | |
| extendedTimeOut: 0, | |
| onclick: function (toast) { | |
| let userResponseValue = toast.target.value; | |
| if (userResponseValue == 'yes') { | |
| console.log(toast.target.value, 'carai'); |
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
| $targetDir= "C:\data" | |
| get-ChildItem $targetDir | select name | OUT-File "C:\log\files.txt" |
NewerOlder