Geeksforgeeks

Error

×

Leaderboard

Showing:

Handle | Score |
---|---|

@Ibrahim Nash | 5725 |

@blackshadows | 5685 |

@akhayrutdinov | 5111 |

@mb1973 | 4989 |

@Quandray | 4908 |

@saiujwal13083 | 4156 |

@sanjay05 | 3762 |

@marius_valentin_dragoi | 3511 |

@sushant_a | 3453 |

@KshamaGupta | 3318 |

@the_coder95 | 3302 |

Complete Leaderboard | |

Handle | Score |

@shashi1iitk | 398 |

@Suniti Jain | 114 |

@ankish2000nayak | 104 |

@gopalsethlnct | 94 |

@senthil1185 | 90 |

@esmadhan | 90 |

@gyanadipta07 | 89 |

@satwikdash2000 | 85 |

@varunmishra3040 | 83 |

@gamec1634 | 82 |

@pj_1721 | 80 |

Complete Leaderboard |

Given two strings of lowercase alphabets and a value **K**, your task is to complete the given function which tells if two strings are** K-anagrams** of each other or not.

Two strings are called K-anagrams if** both of the below **conditions are true.

1. Both have **same **number of characters.

2. Two strings can become anagram by **changing **at most **K** characters in a string.

**Input Format:**

The first line of input contains an integer **T **denoting the no of test cases. Then** T** test cases follow. The first line of input contains two Strings **Str1 **and **Str2**. And next line contains an integer **K**, which denotes number of characters can be replaced.

**Output Format:**

For each testcase, in a new line, print the respective output.

**Your Task:**

Since this is a function problem, you don't need to take any input. Just complete the given function **areKAnagrams **that **returns true** if the strings can be turned into K-anagrams, else return **false**.

**Constraints:**

1 <= T <= 100

1 <= K <= |length of String|

**Example:
Input:**

1

fodr gork

2

1

**Explanation:
Testcase1: **change fd to gk

Login to report an issue on this page.

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes
Check if two strings are k-anagrams or not

...

Please choose 'ReadOnlyMode' if you needn't to 'Edit' the problem e.g. viewing OJ's solution, TestCase Files (TCFs), TimeLimit etc.