<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sarthak Kulkarni</title>
    <description>The latest articles on DEV Community by Sarthak Kulkarni (@combustrrr).</description>
    <link>https://dev.to/combustrrr</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2274271%2F312c4b88-2c8f-45d8-bfb9-ff64336f2c95.jpg</url>
      <title>DEV Community: Sarthak Kulkarni</title>
      <link>https://dev.to/combustrrr</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/combustrrr"/>
    <language>en</language>
    <item>
      <title>Solved a String Permutation Problem in Java</title>
      <dc:creator>Sarthak Kulkarni</dc:creator>
      <pubDate>Fri, 25 Oct 2024 15:05:33 +0000</pubDate>
      <link>https://dev.to/combustrrr/solved-a-string-permutation-problem-in-java-2jej</link>
      <guid>https://dev.to/combustrrr/solved-a-string-permutation-problem-in-java-2jej</guid>
      <description>&lt;h2&gt;
  
  
  Question:
&lt;/h2&gt;

&lt;p&gt;Given two strings A and B, check if they can be rearranged to match (i.e., check if they are permutations of each other).&lt;/p&gt;

&lt;h2&gt;
  
  
  My Solution:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import java.util.Arrays;

`public class Solution {
    public int permuteStrings(String A, String B) {
        if (A == null || B == null || A.length() != B.length()) {
            return 0;
        }
        char A1[] = A.toCharArray();
        Arrays.sort(A1);
char B1[] = B.toCharArray();
Arrays.sort(B1);
return Arrays.equals(A1, B1) ? 1 : 0;
}
}`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  References:
&lt;/h2&gt;

&lt;p&gt;W3Schools on equals()&lt;br&gt;
GeeksforGeeks on Sorting Characters&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Learned:
&lt;/h2&gt;

&lt;p&gt;The difference between reference and content equality in Java.&lt;br&gt;
Importance of input validation and handling edge cases.&lt;/p&gt;

</description>
      <category>interviewbit</category>
    </item>
  </channel>
</rss>
