Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Every name is sorted in alphabetically.
- [danhenriquesc](https://github.com/danhenriquesc)
- [hundredrab](https://github.com/hundredrab)
- [jackey8616](https://github.com/jackey8616)
- [mateusguerra](https://github.com/mateusguerra)
- [mirianashvili](https://github.com/mirianashvili)
- [Obsinqsob01](https://github.com/Obsinqsob01)
- [PyPatel](https://github.com/PyPatel)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ https://www.hackerrank.com/contests/code-and-the-curious/challenges
| Alternating Characters | ✓ | | |
| String Construction | | | ✓ |
| Ashton and String | | ✓ | |
| Two Strings | | | ✓ |
| Two Strings | | | ✓ |

**Sorting**

Expand Down
27 changes: 27 additions & 0 deletions algorithms/strings/two_strings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/python3

import os

# Complete the twoStrings function below.
def twoStrings(s1, s2):
intersection = set(s1) & set(s2)
if len(intersection) > 0:
return "YES"
return "NO"


if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')

q = int(input())

for q_itr in range(q):
s1 = input()

s2 = input()

result = twoStrings(s1, s2)

fptr.write(result + '\n')

fptr.close()
29 changes: 29 additions & 0 deletions data_structures/arrays/left_rotation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

// Complete the rotLeft function below.
function rotLeft($a, $d) {
$shift = array_splice($a, 0, $d);
return array_merge($a, $shift);
}

$fptr = fopen(getenv("OUTPUT_PATH"), "w");

$stdin = fopen("php://stdin", "r");

fscanf($stdin, "%[^\n]", $nd_temp);
$nd = explode(' ', $nd_temp);

$n = intval($nd[0]);

$d = intval($nd[1]);

fscanf($stdin, "%[^\n]", $a_temp);

$a = array_map('intval', preg_split('/ /', $a_temp, -1, PREG_SPLIT_NO_EMPTY));

$result = rotLeft($a, $d);

fwrite($fptr, implode(" ", $result) . "\n");

fclose($stdin);
fclose($fptr);